Installed JREs & Compiler

发布时间 2023-08-25 16:34:02作者: zno2

 

 

已安装 1.7 和 1.8 (默认是1.8)

Option

Description

Installed JREs The current listing of installed JREs, allowing you to select the one to act as the workspace default 

Compiler compliance level : 默认是 1.7

Option

Description

Default

Compiler compliance level

Specifies the compiler compliance level.

Depends on default JRE 

关于Window - Preferences - Java - Compiler 的一点小知识

关于Window - Preferences - Java - Installed JREs 的一点小知识

最终决定项目构建时运行的JRE是 项目Build Path 里的JRE (maven项目如果不指定插件,默认是JRE1.5)

当Installed JREs 中不存在与pom.xml 中匹配的jre时,显示的是pom中定义的,真正使用的Installed JREs 中默认的,这点非常容易被误导需要多加注意,如下图:

 

 

摘自

Note that if you are using Studio with any project using the Java 5.0 compiler (Compiler compliance level of 5.0), then the Eclipse instance should be launched using Java 5.0 as well.

 

摘自

When you install Eclipse, the compiler compliance level is set to 1.6. This must remain 1.6 to reflect the correct version of the JDK.

 

摘自

The Java 8 compiler will produce class files in the Java 8 version of the class file format, and accept Java 8 source files. JRE 6 can't load this version, because it was created after JRE 6 was.

 

 

 

 

新建普通 java project 项目时,可能要面对上面这些警告,使用maven 可以指定 compiler (这个好)