简体   繁体   中英

Eclipse Does Not Recognize JRE 8 as Greater Than JRE 5

I have installed Java 8 on my machine and have started a project with it. However, when I use an @Override annotation, the code is underlined in red, and the error Syntax error, annotations are only available if source level is 1.5 or greater appears.

I have installed the released Eclipse Java Development Tools Patch with Java 8 support (for Kepler SR2), but this only adds support for new features in Java 8, and does not fix the bug with annotations.

Make sure your INSTALLED_JRE is pointing to jdk 1.8 in eclipse

Preference > java > installed_jre

Make sure java > compiler is set to 1.8 in eclipse

preference > java > compiler > compiler compliance level 

默认情况下将设置1.4版本,因此请确保在eclipse IDE中设置首选项> java>编译器>编译器合规性级别

如果您使用的是maven,可以尝试右键单击项目名称并运行Maven / Update Project。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM