DEV Community

Angie Jones
Angie Jones

Posted on

IntelliJ - Error:java: release version 5 not supported

A common error in IntelliJ when attempting to run a new Java maven project is Error:java: release version 5 not supported.

Here are 3 techniques to resolve this. Try them in order. If one doesn't resolve the issue, try the next.

1. Update Java Compiler

  • Go to IntelliJ IDE menu item (or File on Windows) -> Preferences -> Build, Execution, Deployment -> Java Compiler

  • Delete value under Target bytecode version, then click OK

  • Refresh maven

  • Try running again. If problem persists, continue on to number 2 below

2. Update SDK Version

  • Go to File -> Project Structure -> Project Settings -> Project. Make sure you have the correct Java version selected. It should be the same as the one you downloaded

  • Also on this same panel, go to Platform Settings -> SDKs. Make sure you have the correct Java version selected

  • Click OK

  • Refresh maven

  • Try running again. If problem persists, continue on to number 3 below

3. Add property to pom.xml

  • Within IntelliJ, open pom.xml file

  • Add this section before <dependencies> (If your file already has a <properties> section, just add the <maven.compiler...> lines below to that existing section):

   <properties> 
      <maven.compiler.source>1.8</maven.compiler.source> 
      <maven.compiler.target>1.8</maven.compiler.target> 
   </properties>
Enter fullscreen mode Exit fullscreen mode
  • Change the x in 1.8 to your Java version. For example, if you’re using Java 13, change 1.8 to 1.13

  • Refresh maven

  • Try running again

Latest comments (35)

Collapse
Collapse
 
collinsuz profile image
Collins Uzebu • Edited

There are many great answers here. If you imported your maven project from spring initializr, make sure the project is set to your your java version. In my case Java 16.

Goto File > Project Structure > Modules
Select the project folder, next change the Language level to your Java version, apply and click OK.

Collapse
 
khmarbaise profile image
Karl Heinz Marbaise

Just a small hint. For JDK9+ you have to use 9 or 10 etc. instead of 1.X cause 1.X does not exist for JDK9+.

So for JDK13 you have to use 13 instead of 1.13...

Collapse
 
geekypandey profile image
Anurag Pandey

Thanks a lot!

Collapse
 
cherylleoni profile image
cherylleoni

Step 3 worked like a charm for me. Thank you!

Collapse
 
olgamaciaszek profile image
Olga Maciaszek-Sharma

Nice tip with the Java Compiler setup. Thanks.

Collapse
 
cpave3 profile image
Cameron Pavey

For me, adding the property to pom.xml saved the day. Thanks for sharing!

Collapse
 
richard_kollar profile image
Richard Kollár

Thank you Angie, the last step worked for me.

Collapse
 
duka_pa profile image
duka_pa

Thx Angie..... the third solution worked for me. Tried all of them but finally success with the third one. Thx

Collapse
 
osamawaqarsheik profile image
Osama sheikh

Thank you :)
very much helpful.

Collapse
 
sabbaghov007 profile image
sabbaghov007

Thank you!

Collapse
 
jey84 profile image
jEy84

How can I Fixx this ???????

Collapse
 
joewood_85 profile image
Joe Wood

Thank you, Angie. New to Maven and new to IntelliJ; option 3 did it for me.

Collapse
 
diana0303 profile image
Diana0303

thank you so much! you really saved me

Collapse
 
joinsaad profile image
Mohammad Saad

Thanks, step 2 fixed mine. Thank you very much.