Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ: Error: java: release version 10 not supported

In IntelliJ, I'm getting this strange error message when I try to build from the build menu

Error: java: release version 10 not supported

I don't understand this, since in Project Structure, I have these settings set:

Project SDK: 9.0
Project Language Level: SDK Default
Module Language Level: Project Default (both modules)

In my pom.xml files, I have these properties set in both modules:

<maven.compiler.source>9</maven.compiler.source>
<maven.compiler.target>9</maven.compiler.target>

I have no idea why it's trying to use JDK 10 for anything, but I still get that message.

I'd be happy to use JDK 10, but my project doesn't work in that version, so I'm going back to see which versions it works in. I have SDKs installed for version 1.4 through 10.

I've also tried building using JDK 1.8, but I get a slightly different error message:

Error: java: invalid target release: 10

I've found that I can build from the command line using JDK 9, but I need to build from my IDE.

Can anyone tell me how to build my project using JDK 1.9 or 1.8?

like image 657
MiguelMunoz Avatar asked Oct 13 '18 01:10

MiguelMunoz


People also ask

What is the error Java error release version 5 not supported?

1 Answer. The reason is Maven sets the default Java version to 1.5. Hence you need to set the language level and release version in pom. xml file correctly.

What version of Java does IntelliJ use?

Java 11 in IntelliJ IDEA 2018.2.


3 Answers

I got a similar error but did not use Maven.

It's resolved by updating the IntelliJ configuration:

  • File -> Settings-> Build, Execution, Development -> Compiler -> Java Compiler
  • update Project bytecode version to 8

enter image description here

like image 162
Yihe Avatar answered Oct 08 '22 01:10

Yihe


I had similar issue except that the error was "release version 5 not supported. " I tried all of the above and other proposed solutions but nothing worked, except putting following xml into the pom.xml file:

<properties>
    <maven.compiler.release>11</maven.compiler.release>
</properties>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

Code comes from: Maven in 5 Minutes | Apache Maven Project

After putting this code in pom.xml, make sure to Import Changes or Enable Auto-Import for the Maven project:

Intellij popup box

like image 24
smilesr Avatar answered Oct 08 '22 00:10

smilesr


The most upvoted answer really helped me. However, for me the problem wasn't the Project bytecode version. Instead, my Maven module was marked with Target bytecode version 1.5, see picture below.

Just clicking the row and removing it fixed the problem:

  • File -> Settings-> Build, Execution, Development -> Compiler -> Java Compiler
  • Delete any Per-module bytecode versions in the list, which override the project bytecode version.

Per-module bytecode version

like image 25
Magnilex Avatar answered Oct 08 '22 02:10

Magnilex