The type java.lang.String cannot be resolved. It is indirectly referenced

时间:2024-03-24 09:12:19

 

 

- The type java.lang.String cannot be resolved. It is indirectly referenced
解决jdk版本过高不兼容问题,一般为jdk8的常出现的bug

重新部署较低版本jdk可以解决问题,以下示例

下载链接:https://download.csdn.net/download/lizhuxie7146/11191010

一、JDK安装

(1)jdk安装直接next就可以了(有需要更改安装目录的中间调整下jdk跟jre的安装位置)

二、JDK环境配置

(1)新建->变量名"JAVA_HOME",变量值"C:\Java\jdk"(即JDK的安装路径) 
(2)编辑->变量名"Path",在原变量值的最后面加上“;%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin” 
(3)新建->变量名“CLASSPATH”,变量值“.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar”

cmd———》java -version,会显示当前JDK版本

(本人JDK配置成1.7之后依旧显示JDK1.8的版本(⊙o⊙)...目测没有什么大影响,下面继续...)

三、打开eclipse---window---installed jres---add---next---添加JDK的位置

The type java.lang.String cannot be resolved. It is indirectly referenced

The type java.lang.String cannot be resolved. It is indirectly referenced

The type java.lang.String cannot be resolved. It is indirectly referenced

finish之后选择刚配置的JDK的checkbox,然后apply就可以了

到这里就完成了eclipse的JDK配置

四、接下来修正项目工程

右键出错的项目找到properties

The type java.lang.String cannot be resolved. It is indirectly referenced

The type java.lang.String cannot be resolved. It is indirectly referenced

The type java.lang.String cannot be resolved. It is indirectly referenced

直接finish就可以了

等到右下角的进度条跑完了,不兼容的问题就消失了