What do you do when you create a new Maven Java project, and when you run it, you get the following error:
Error:java: error: release version 5 not supported
Open the project’s
pom.xml file and add the following snippet:
<properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties>
Now open the Maven side-panel, and click the
Report All Maven Projects button.
You can now successfully run your new Maven Java project.
The release version 5 not supported error is quite common with newly created projects.
The java error is frequently seen in IntelliJ after a new Maven project has begun and full setup has not been completed.
By default, the
project bytecode version is not actually set in Java maven projects.
Therefore it believes that your current version is set to 5.
java compiler and change your bytecode version to your current java version.
An alternative solution
If the above does not work for you when trying to solve the java error: release version 5 not supported in IntelliJ, you can attempt the following alternative:
- Open the IntelliJ preferences dialog.
- Filter the navigation items by typing
- Move to the Maven->Java Compiler section.
- In the right hand configuration panel, there is a list of modules and their accompanying Java compile versions. This is called the
target bytecode version.
- Finally select a version bigger than 1.5.
Note that if there is no version greater than 1.5 available in the above list, then you will need to upgrade your Java Development Kit (JDK) on the local machine.
Once all of these steps have been completed, you may also want to go to the
Project Structure contextual menu and select
Modules. Under here you will have the option to change each of the module’s
You can also always just update your
pom.xml to contain the following:
<properties> <java.version>11</java.version> </properties>
This will fix your
java: error: release version 5 not supported problem encountered while trying to run, or execute a Maven Java application in IntelliJ IDEA.