简体   繁体   English

无法在Eclipse中更改JRE版本

[英]Can't change the jre version in eclipse

I got an error "Syntax error, 'for each' statements are only available if source level is 1.5 or greater" in eclipse. 我在日食中收到一个错误“语法错误,'对于每个'语句仅在源级别为1.5或更高时才可用”。 The jre system library being used is oracle-java-6 and I also enable project specific settings and set complier level to 1.6 but the error is still there. 正在使用的jre系统库是oracle-java-6,我还启用了项目特定的设置,并将编译器级别设置为1.6,但错误仍然存​​在。 Please help, thanks ahead. 请帮忙,谢谢。

4. ERROR in /home/johnny/Application/GWTPV/ParaViewWeb/WebServer/PWApp/src/org/paraview/server/AvailableDataFilter.java (at line 65)
ArrayList<FileBean> tmpfileNames = new ArrayList<FileBean>();
          ^^^^^^^^
Syntax error, parameterized types are only available if source level is 1.5

Check out the build path configuration (In the package viewer select the project root element and right mouse clic). 签出构建路径配置(在程序包查看器中,选择项目根元素,然后单击鼠标右键)。 Then check the Library setting. 然后检查库设置。 Often changing the JRE leaves the Library still set to 1.5. 通常,更改JRE会使Library仍设置为1.5。

  1. Right click on the project -> Build Path -> Configure build path 右键单击项目->构建路径->配置构建路径
    or 1B. 或1B。 Right click on project -> properties -> Java build path 右键单击项目->属性-> Java构建路径
    or 1C. 或1C。 Find the error in the Problems view, select it and click [ctrl]+[1] -> Configure build path 在“问题”视图中找到错误,将其选中,然后单击[ctrl] + [1]->配置构建路径

  2. Open Libraries tab -> choose add library (or edit an exsting JRE on the list) -> JRE -> Alternate JRE -> click Installed JREs -> choose one 打开库选项卡->选择添加库(或在列表中编辑现有的JRE)-> JRE->备用JRE->单击已安装的JRE->选择一个

  3. If you can't see the JRE you're looking for on the list (that is version 1.5 or greater): Add -> standard JVM -> in JRE home field enter the location of your JRE on the disc. 如果在列表中(版本1.5或更高版本)找不到所需的JRE:在JRE主页字段中,添加->标准JVM->输入JRE在光盘上的位置。

Look at the tab "Java compiler" in your project properties. 查看项目属性中的“ Java编译器”选项卡。 If your default jdk compilance is less than 1.5 you should check "Enable project specific settings" and edit "Compiler compilance level" to 1.5, 1.6... 如果您的默认jdk编译小于1.5,则应选中“启用项目特定设置”,然后将“编译器编译级别”编辑为1.5、1.6 ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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