IntelliJ: Fatal error compiling: invalid target release: 1.8

前端 未结 3 932
遥遥无期
遥遥无期 2021-01-05 19:08

I\'m running a Java Maven project on IntelliJ, and I make sure that this project will be compiled by Java 1.8.

I set JRE to version 8 in Run/Debug Configuration

相关标签:
3条回答
  • 2021-01-05 19:13
    • Make sure JAVA_HOME is set to JDK7 or JRE7. This is explained in the following link

    • Make sure that you open a new shell an run intellij

    • If this doesnt work, look at at the idea.bat file which is used to run intellij - make sure it uses jdk7/jre7
    • Make sure the JDKs are defined properly in your project. Look at this link for more information.
    • Make sure that the source is defined as 1.7 at maven

    The above 4 steps always helped me to troubleshoot such issues.

    0 讨论(0)
  • 2021-01-05 19:17

    Look in Build Execution, Deployment > Compiler > Java Compiler

    Then look for per module bytecode version

    0 讨论(0)
  • 2021-01-05 19:28

    I assume you want to have it in version 8, despite so many comments telling you to set to 7.

    You probably missed the setting for the maven runner, this is under Preferences -> Build, Exection, Deployment > Build Tools > Maven > Runner, see attached image. You need to set that to Java 8 as well.

    0 讨论(0)
提交回复
热议问题