String cannot be resolved to a type - Java RAD

孤街浪徒 提交于 2020-12-30 06:14:17

问题


I've recently started developing in Java (coming from .Net). The IDE I am using is RAD 7.3.

After importing a project, which I need to do some enhancements on, I am receiving this error:

"String cannot be resolved to a type"

This applies to all variables of the String data type, as well as any methods that take string arguements. I'm very inexperienced with Java so I'm not sure how to go about fixing this. My guess is that it has something to do with the way RAD was installed, and that required libraries are missing. Again, not sure how to address that.

Any help or guidance would be much appreciated! Thank you


回答1:


My guess is you miss the JRE Runtime Library in your project. But this would cause all the java.* classes to generate this message! Can you post your code so we can see what might be the problem?

try doing :

right-click on your project. ->properites ->java Build Path ->tab Librairies

check if the JRE System Library is there.




回答2:


i am a beginner. i am using Eclipse and got stuck at the Hello World code. Got same error description and also error stating can't resolve 'system'.

After staying frustrated for few hours, as I checked JRE library path and stuff, I just Capitalized 'S' of 'string' and 'system'.. and bang.. problem solved. I hope this helps.




回答3:


I don't know if this helps anyone, but here I go. I had the same problem just now in Visual Studio Code (I am on Linux). On my java.home, I had the options in my directory of:

  • /usr/lib/jvm/java-8-openjdk-amd64
  • /usr/lib/jvm/java-1.8.0-openjkd-amd64

I had the first one as default, but when I switched to the second one, it all started working properly.




回答4:


Another way to solve this problem is in the following way.

Right click on the project-->properties-->Java build path-->go to the library option

and delete or remove the library that is in error, after this you select add library and download the library that you deleted and ready.




回答5:


You need to capitalize the "s" in the string.




回答6:


error- string cannot be resolved to a type

Here in the declaring the method "string" in bold is lower case. Change string to upper case. Example: public static string howManyPass(double grd1, double grd2) { }



来源:https://stackoverflow.com/questions/7651768/string-cannot-be-resolved-to-a-type-java-rad

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!