0

So far, I find these places talking about JDK version

  1. Settings -> Java Compiler -> Project Bytecode
  2. Project Settings -> Modules -> Sources and set language level
  3. .idea/compiler.xml: <module name="my_module" target="1.8" />
  4. Windows JAVA_HOME
  5. pom.xml

    <properties>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    

After setting each of them to JDK8 the compiler still defaults to 1.5 and fails

Error:(59, 21) java: try-with-resources is not supported in -source 1.5

Three questions:
What are the other hidden places to set JDK version?
Which setting wins if each place has a different setting?
How to specify not just JDK8, but JDK8u201?

Stepan
  • 1,391
  • 18
  • 40
  • Your question is based on a false premise. There is no order of precedence. IntelliJ automatically populates those values from the POM. If you change them in the project and then re-import the POM (the little circular arrow button in the Maven panel) then the ones in the IntelliJ project settings will revert back to how they are in the POM. – Michael Apr 04 '19 at 16:22
  • There is a top-level project language level at Project Settings > Project > Project language level that you have not mentioned but, again, this is driven by the POM. – Michael Apr 04 '19 at 16:25

0 Answers0