字符串无法解析为类型 - Java RAD
我最近开始使用 Java 进行开发(来自 .Net)。我使用的IDE是RAD 7.3。
导入需要对其进行一些增强的项目后,我收到此错误:
“字符串无法解析为类型”
这适用于字符串数据类型的所有变量,以及任何采用字符串争论的方法。我对 Java 非常缺乏经验,所以我不知道如何解决这个问题。我的猜测是,这与 RAD 的安装方式有关,并且缺少所需的库。再次,不知道如何解决这个问题。
任何帮助或指导将不胜感激!谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
我的猜测是您错过了项目中的 JRE 运行时库。但这会导致所有 java.* 类生成此消息!您可以发布您的代码以便我们看看可能是什么问题吗?
尝试这样做:
右键单击您的项目。
-> 属性
->java 构建路径
->选项卡 Libraries
检查 JRE 系统库是否存在。
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.
我是初学者。我正在使用 Eclipse,但卡在了 Hello World 代码中。收到相同的错误描述,并且还显示错误无法解析“系统”。
沮丧了几个小时后,当我检查 JRE 库路径和其他内容时,我只是将“字符串”和“系统”的“S”大写......然后砰......问题解决了。我希望这有帮助。
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.
我不知道这是否对任何人有帮助,但我来了。
我刚才在 Visual Studio Code 中遇到了同样的问题(我在 Linux 上)。在我的 java.home 上,我的目录中有以下选项:
我默认使用第一个,但是当我切换到第二个时,一切都开始了工作正常。
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:
I had the first one as default, but when I switched to the second one, it all started working properly.
您需要将字符串中的“s”大写。
You need to capitalize the "s" in the string.
解决这个问题的另一种方法是通过以下方式。
并删除或删除有错误的库,之后选择添加库并下载已删除并准备好的库。
Another way to solve this problem is in the following way.
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.
这里在声明方法时,粗体的“string”是小写的。
将字符串更改为大写。
例子:
公共静态字符串 howManyPass(双grd1,双grd2){
}
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) {
}
对于 Spring Boot 用户,请检查您的 pom.xml 文件,了解您最新添加的依赖项是什么。对我来说,一旦删除了一些依赖项,问题就消失了。
For Spring Boot users, please check your pom.xml file as what are the dependencies you've added in latest. For me the problem was gone once I removed some dependencies.