close

[Solved] Main has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Hello Guys, How are you all? Hope You all Are Fine. Today I just updated IntelliJ But I am facing following error Main has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0 in Java. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How This Error Occurs ?

I just updated IntelliJ But I am facing following error.

D:\MyProject\ProjectExcercise\src>java com.codewithmosh.Main
Error: A JNI error has occurred, please check your installation and try again
Exception in thread “main” java.lang.UnsupportedClassVersionError: com/ssc/Main has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)

How To Solve Main has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0 Error ?

  1. How To Solve Main has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0 Error ?

    To Solve Main has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0 Error First of all Select File in your Intellij IDEA. Then select Settings. Select Build, Execution, Deployment. Now, Gradle. Then, Gradle JVM. Select eg. Project SDK (corretto-1.8) (or any other compatible version). Then delete the build directory and restart the IDE. Second Solution is You need to add PATH environment setting. C:\Program Files\Java\jdk-13 you currently have there is not correct. You just need to add bin subdirectory for the latest JDK version at the top of the PATH list. java.exe executable is in C:\Program Files\Java\jdk-13\bin directory, so that is what you need to have in PATH. And your error will be solved.

  2. Main has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0

    To Solve Main has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0 Error First of all Select File in your Intellij IDEA. Then select Settings. Select Build, Execution, Deployment. Now, Gradle. Then, Gradle JVM. Select eg. Project SDK (corretto-1.8) (or any other compatible version). Then delete the build directory and restart the IDE. Second Solution is You need to add PATH environment setting. C:\Program Files\Java\jdk-13 you currently have there is not correct. You just need to add bin subdirectory for the latest JDK version at the top of the PATH list. java.exe executable is in C:\Program Files\Java\jdk-13\bin directory, so that is what you need to have in PATH. And your error will be solved.

Solution 1: make this setting in IntelliJ IDEA

  1. First of all Select File in your Intellij IDEA.
  2. Then select Settings.
  3. Select Build, Execution, Deployment.
  4. Now, Gradle.
  5. Then, Gradle JVM.
  6. Select eg. Project SDK (corretto-1.8) (or any other compatible version).
  7. Then delete the build directory and restart the IDE.

Solution 2: select SDK default

  1. First of all Go to “Project Structure”.
  2. Then Select Project.
  3. Select Project language level.
  4. and select SDK default.
  5. This should use the same SDK for all project modules.
  6. Now, Your error should be solved.

Solution 3: add environment PATH

You need to add PATH environment setting. C:\Program Files\Java\jdk-13 and you currently have there is not correct. You just need to add bin subdirectory for the latest JDK version at the top of the PATH list. java.exe executable is in C:\Program Files\Java\jdk-13\bin directory, so that is what you need to have in PATH.

Add This in PATH variable.

C:\Program Files\Java\jdk-13\bin

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Please Rate Our Solution to Motivate Us For Give Our Best

Leave a Comment