search

Home  >  Q&A  >  body text

java - idea每次编译的时候都是使用的jdk1.5

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中设置并没有作用。

大家讲道理大家讲道理2804 days ago977

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-04-18 10:57:54

    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>
    

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 10:57:54

    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.

    reply
    0
  • Cancelreply