2

Eclipse The type java.lang.String cannot be resolved

 1 year ago
source link: https://www.wencst.com/archives/2446
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Eclipse The type java.lang.String cannot be resolved

作者: wencst 分类: JAVA,程序设计 发布时间: 2024-02-01 14:33 阅读: 14 次

最近更新了eclipse版本,在新版的eclipse中,引用maven工程后,提示信息:

The type java.lang.String cannot be resolved. It is indirectly referenced from required .class files
img_65bb3d9054ab1.png

以前在旧版eclipse中没有问题,开始以为是eclipse新版的bug,就换回了旧版。但是神奇的发现,原来没问题的工程,在旧版中也有问题了。

问题跟eclipse版本没有太大关系了,那就是eclipse环境配置的问题。

对比了新旧版本的maven环境,没有问题。

修改了工程环境,删除了工程中的eclipse相关文件(.project,.settings),发现还是不起作用。

搜索了百度、谷歌、问了chatgpt,没有找到有用的信息。

后来发现了一篇文章——https://blog.csdn.net/cheng__lu/article/details/107611010

eclipse中引用的jdk错误,我本地安装了两个jdk1.8,eclipse选择的不对。

1.打开eclipse,从当前workspace中删除工程

2.退出eclipse

3.删除工程下的.project和.settings文件

4.打开eclipse

5.修改eclipse中jdk1.8对应的版本

6.在导入的项目上右击->properties->Java Bulid Path->Libraries 将jdk删除 -> Apply and close。

7.之后再在导入的项目上右击->properties->Java Bulid Path->Libraries->JRE System Library,选择正确的jdk版本即可。

img_65bb3ae9dcb84.png

如果文章对您有用,扫一下支付宝的红包,不胜感激!

欢迎加入QQ群进行技术交流:656897351(各种技术、招聘、兼职、培训欢迎加入)

Leave a Reply Cancel reply

You must be logged in to post a comment.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK