Java compiler level does not match 问题解决

导入一个新的项目,可能会出现Java compiler level does not match  错误,这是因为eclipse和该项目的JDK编译版本不同导致的。


1,首先查看eclipse的jdk编译版本

Java compiler level does not match 问题解决Java compiler level does not match 问题解决

2,搜索compile,设置编译出的文件使用的格式是JDK1.7

Java compiler level does not match 问题解决

Java compiler level does not match 问题解决

3,进入项目,把项目–prorerties–Java compile,把项目的编译版本设置为1.7。

Java compiler level does not match 问题解决

4,最后,还是进入项目–properties–project Facets,将java 设置为1.7。

Java compiler level does not match 问题解决 Java compiler level does not match 问题解决

5,当设置完这些后,项目如果又报错(我的情况如下)

Description ResourcePathLocationType
Access restriction: The type UtilSystemException is not accessible due to restriction on required library C:\Program Files\Java\jre7\lib\rt.jar

Java compiler level does not match 问题解决

1)此时,右键选中项目–build path–configure build path –Java build path ,把JRE system Libarary 选中Remove掉

Java compiler level does not match 问题解决

2)重新 右键选中项目–build path–add  Library  如图即可

Java compiler level does not match 问题解决Java compiler level does not match 问题解决