java - idea每次编译的时候都是使用的jdk1.5
大家讲道理
大家讲道理 2017-04-18 10:55:54
0
2
973

idea每次新建project的话,采用的编译器都是1.5,所以每次都要进行下面的设置:

1.在Project Structure中设置Language Level为8.0

2.在Settings中的Java Compiler中设置Target bytecode version为1.8

为什么每次都要重新设置,怎样设置才能让以后新建项目的时候idea采用的jdk都是1.8,而不是1.5?

ps: 在default settings中设置并没有作用。

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(2)
Ty80

You set it in pom.xml so that idea will not adjust jdk to 1.5 when running. .

<properties>
   <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>          
   <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
   <java.version>1.8</java.version>
   <maven.compiler.source>1.8</maven.compiler.source>
   <maven.compiler.target>1.8</maven.compiler.target>
   <encoding>UTF-8</encoding>
</properties>
Ty80

This shouldn’t be a big problem
The compilation environment should be in dependencies.
This language level seems to be the prompts and suggestions of the editor interface, which allows you to write code that is compatible with your features in 1.5. If you do not change the editor, you will get an error, but there will be no problem compiling with 1.7.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template