Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class file has wrong version 52.0, should be 50.0

I'm trying to compile my project in IntelliJ idea. I'm using a class in an external jar file and on compilation receiving the following error.

Class file has wrong version 52.0, should be 50.0 

I understand that it's saying the jar file was compiled with a newer Java version than that which IntelliJ is using. My question is how do I make them compatible? I have updated the Java on my Mac to 1.8 and when I run java -version or javac -version it confirms this.

What am I missing? (Apart from Java development experience)

like image 613
jaywayco Avatar asked Jan 27 '15 22:01

jaywayco


2 Answers

Select "File" -> "Project Structure".

Under "Project Settings" select "Project"

From there you can select the "Project SDK".

like image 118
Vlad Spreys Avatar answered Sep 27 '22 19:09

Vlad Spreys


It means your Java runtime version is 1.6, but your compiler version (javac) is 1.8. To simply solve it, just advance your JVM version to 1.8.

But if you don't want to change the Java runtime version, then do the following steps:

  1. JAVA_HOME= "your jdk v1.8 folder path", to make sure jdk is also v1.8 and use java -version and javac -version again to ensure it
  2. Make sure IntelliJ's compiler mode is set to compliant with v1.6 But i have tried that. it didn't solve my problem.
like image 42
CodeLikeNoonesBusiness Avatar answered Sep 27 '22 20:09

CodeLikeNoonesBusiness