Java Eclipse 无法将 JRE 8 识别为大于 JRE 5
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23325667/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse Does Not Recognize JRE 8 as Greater Than JRE 5
提问by Dave C
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.
我已经在我的机器上安装了 Java 8 并用它启动了一个项目。但是,当我使用@Override
注释时,代码以红色下划线,并Syntax error, annotations are only available if source level is 1.5 or greater
出现错误。
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.
我已经安装了已发布的带有 Java 8 支持的 Eclipse Java 开发工具补丁(用于 Kepler SR2),但这仅增加了对 Java 8 中新功能的支持,并没有修复带有注释的错误。
采纳答案by Jigar Joshi
Make sure your INSTALLED_JRE is pointing to jdk 1.8 in eclipse
确保您的 INSTALLED_JRE 在 Eclipse 中指向 jdk 1.8
Preference > java > installed_jre
Make sure java > compiler is set to 1.8 in eclipse
确保在 Eclipse 中将 java > compiler 设置为 1.8
preference > java > compiler > compiler compliance level
回答by Gordon Ma
If you are using maven, you can try right click the project name and run Maven/Update Project.
如果您使用的是 maven,您可以尝试右键单击项目名称并运行 Maven/Update Project。
回答by Venkata
by default 1.4 version will set, so make sure set preference > java > compiler > compiler compliance level in eclipse IDE
默认情况下将设置 1.4 版本,因此请确保在 Eclipse IDE 中设置首选项 > java > 编译器 > 编译器合规性级别