close

[Solved] has been compiled by a more recent version of the Java Runtime (class file version 57.0)

Hello Guys, How are you all? Hope You all Are Fine. Today Whenever I am trying to run my project I am facing following error has been compiled by a more recent version of the Java Runtime (class file version 57.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 ?

Whenever I am trying to run my project I am facing following error.

Error: A JNI error has occurred, please check your installation and try again
Exception in thread “main” java.lang.UnsupportedClassVersionError: com/codewithmosh/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

How To Solve has been compiled by a more recent version of the Java Runtime (class file version 57.0) Error ?

  1. How To Solve has been compiled by a more recent version of the Java Runtime (class file version 57.0) Error ?

    To Solve has been compiled by a more recent version of the Java Runtime (class file version 57.0) Error You need to set this setting in IntelliJ IDEA and $JAVA_HOME and language level were set to 1.8. First of all click on File.Then select Settings.And, Go to Build, Execution, Deployment.Select Gradle > Gradle JVM.Select eg. Project SDK (corretto-1.8) or any other compatible version.Then delete the build directory and restart the IDE.Now, Your problem must be fixed.

  2. has been compiled by a more recent version of the Java Runtime (class file version 57.0)

    To Solve has been compiled by a more recent version of the Java Runtime (class file version 57.0) Error You need to set this setting in IntelliJ IDEA and $JAVA_HOME and language level were set to 1.8. First of all click on File.Then select Settings.And, Go to Build, Execution, Deployment.Select Gradle > Gradle JVM.Select eg. Project SDK (corretto-1.8) or any other compatible version.Then delete the build directory and restart the IDE.Now, Your problem must be fixed.

Solution 1: Change Gradle JVM

You need to set this setting in IntelliJ IDEA and $JAVA_HOME and language level were set to 1.8.

  1. First of all click on File.
  2. Then select Settings.
  3. And, Go to Build, Execution, Deployment.
  4. Select Gradle > Gradle JVM.
  5. Select eg. Project SDK (corretto-1.8) or any other compatible version.
  6. Then delete the build directory and restart the IDE.
  7. Now, Your problem must be fixed.

Solution 2: change env variable path

I moved the environment path C:\Program Files (x86)\Common Files\Oracle\Java\javapath below H:\Program Files\Java\jdk-13.0.1\bin

Here is my path Look like.

C:\Program Files\Java\jdk-13.0.1\bin //to JAVA_HOME

C:\Program Files (x86)\Common Files\Oracle\Java\javapath //to JRE_HOME

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