DEV Community

IntelliJ - Error:java: release version 5 not supported

Angie Jones on February 16, 2020

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 t...
Collapse
 
ishwaks profile image
Ishwak Sharda

By default, your "Project bytecode version isn't set in maven project.

It thinks that your current version is 5, so just go to "Project Settings>Build, Execution...>compiler>java compiler" and then change your bytecode version to your current java version.

Have a good day :)

Collapse
 
matthew_c_o profile image
Matthew Ohrenberg

This is what fixed mine. Thank you very much, sir.

Collapse
 
cyalef profile image
Bhavishay Mankani

Thank you so much, it totally worked for me.

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
Collapse
 
lopitz profile image
Lars Opitz

The proper solution for maven-based projects is to change the target version as shown by Angie in option 3. I added some background on the root cause and provided an additional example for spring boot projects and "plain" java projects here:

Collapse
 
pradhan41 profile image
pradhan41 • Edited

None of Angie's steps worked for me but setting build plugin in POM file like below worked for me .
"



org.apache.maven.plugins
maven-compiler-plugin
3.8.1

11
11



"

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
 
sabbaghov007 profile image
sabbaghov007

Thank you!

Collapse
 
osamawaqarsheik profile image
Osama sheikh

Thank you :)
very much helpful.

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
 
joewood_85 profile image
Joe Wood

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

Collapse
 
jey84 profile image
jEy84

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

Collapse
 
mfelipebr profile image
Mario Felipe Nogueira de Almeida

A terceira opção funcionou. Obrigado! The 3th option worked. Thanks.

Collapse
 
donegitit profile image
DoneGitIt

Thanks! This works like a charm.

Collapse
 
diana0303 profile image
Diana0303

thank you so much! you really saved me

Collapse
 
theiotman profile image
theIOTman

This problem usually happen when you create new project in InteliJ. To solve this problem you can follow this video step by step:
youtu.be/ijhk7eLbizM
Sorry for my bad english.

Collapse
 
brulure123 profile image
Benoni Zongwe

Thanks for this fixed, your topic help me very much.

Collapse
 
gleidecn profile image
gleidecn

Thank you Angie so much!!! I loved your tips, my problem was on the pom.xml

Collapse
 
lingzhixu6 profile image
lingzhixu6

Wow works magically!

Collapse
 
jrsofty profile image
Jason Reed

Maven by default always targets JRE 5. You should always configure the correct Java version as you have shown in the pom.xml

Collapse
 
voytekpaterek profile image
Greg

The third option worked. Thank you!

Collapse
 
nathanverrilli profile image
nathanverrilli

New to Maven, and this indeed bit me. Changing the targeted release in the POM file un-confused Intellij (per your option 3) -- thank you!

Collapse
 
dastinsandura profile image
Dastin Sandura

Adding maven properties helped! Thanks for this article Angie :D

Collapse
 
dopplergit profile image
dopplerGit

Yeah I had the same problem, Why don't the ItelliJ just add these things by itself.

Android studio is so nice to work with everything is auto.

Collapse
 
tabletin profile image
Rafael Vidal

Angie solution number 3 worked fine for me!
thanks Angie!

Collapse
 
mobilevisuals profile image
mobilevisuals

It works!

Collapse
 
bharath33 profile image
Bharath

Thanks a lot Angie Jones, this helped me to solve my problem.

Collapse
 
joinsaad profile image
Mohammad Saad

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

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
 
davidhuaricancha profile image
David Jesus Huaricancha Abad

That's right, thank you very much, the third recommend of Angie, it worked for me.