IntelliJ: Error:java: error: release version 5 not supported

We Are Going To Discuss About IntelliJ: Error:java: error: release version 5 not supported. So lets Start this Java Article.

IntelliJ: Error:java: error: release version 5 not supported

Advertisements
  1. IntelliJ: Error:java: error: release version 5 not supported

    Took me a while to aggregate an actual solution, but here's how to get rid of this compile error.
    Open IntelliJ preferences.
    Search for “compiler” (or something like “compi”).
    Scroll down to Maven –>java compiler. In the right panel will be a list of
    modules and their associated java compile version “target bytecode version.”
    Select a version >1.5. You may need to upgrade your jdk if one is not available.

  2. Error:java: error: release version 5 not supported

    Took me a while to aggregate an actual solution, but here's how to get rid of this compile error.
    Open IntelliJ preferences.
    Search for “compiler” (or something like “compi”).
    Scroll down to Maven –>java compiler. In the right panel will be a list of
    modules and their associated java compile version “target bytecode version.”
    Select a version >1.5. You may need to upgrade your jdk if one is not available.

Solution 1

Advertisements

See https://stackoverflow.com/a/12900859/104891.

First of all, set the language level/release versions in pom.xml like that:

<properties>
  <maven.compiler.source>1.8</maven.compiler.source>
  <maven.compiler.target>1.8</maven.compiler.target>
</properties>

Maven sets the default to 1.5 otherwise. You will also need to include the maven-compiler-plugin if you haven’t already:

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

Also, try to change the Java version in each of these places:

File -> Project structure -> Project -> Project SDK -> 11.

File -> Project structure -> Project -> Project language level -> 11.

File -> Project structure -> Project -> Modules -> -> Sources –> 11

In project -> ctrl + alt + s -> Build, Execution, Deployment -> Compiler -> Java Compiler -> Project bytecode version -> 11

In project -> ctrl + alt + s -> Build, Execution, Deployment -> Compiler -> Java Compiler -> Module -> 1.11.

Original Author Of This Content

Solution 2

Advertisements

Took me a while to aggregate an actual solution, but here’s how to get rid of this compile error.

  1. Open IntelliJ preferences.

  2. Search for “compiler” (or something like “compi”).

  3. Scroll down to Maven –>java compiler. In the right panel will be a list of
    modules and their associated java compile version “target bytecode version.”

  4. Select a version >1.5. You may need to upgrade your jdk if one is not available.

enter image description here

Original Author Of This Content

Solution 3

Advertisements

By default, your “Project bytecode version isn’t set in maven project.

It thinks that your current version is 5.

Solution 1:

Just go to “Project Settings>Build, Execution…>compiler>java compiler” and then change your bytecode version to your current java version.

Solution 2:

Adding below build plugin in POM file:

 <properties>
        <java.version>1.8</java.version>
        <maven.compiler.version>3.8.1</maven.compiler.version>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

Original Author Of This Content

Solution 4

Advertisements

I add the following code to my pom.xml file. It solved my problem.

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

Original Author Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment