Class has been compiled by a more recent version of the Java Environment

JavaEclipseSeleniumFirefoxJava 8

Java Problem Overview


While running Selenium script, I am getting the following error message in the Eclipse console:

> Class has been compiled by a more recent version of the Java Environment (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0.


  • Java Version: 8
  • IDE: Eclipse Oxygen
  • Firefox Version: 46

Java Solutions


Solution 1 - Java

This is just a version mismatch. You have compiled your code using java version 9 and your current JRE is version 8. Try upgrading your JRE to 9.

49 = Java 5
50 = Java 6
51 = Java 7
52 = Java 8
53 = Java 9
54 = Java 10
55 = Java 11
56 = Java 12
57 = Java 13
58 = Java 14
59 = Java 15
60 = Java 16
61 = Java 17
62 = Java 18
63 = Java 19

Solution 2 - Java

IDE: Eclipse Oxygen.3

To temporarily correct the problem do the following:

Project menu > Properties > Java Compiler > Compiler compliance level > 1.8

A permanent fix likely involves installing JDK 9.

FYI 1.8 is what Java 8 is called.

I recently returned to Java after a foray into C# (a breath of fresh air) and installed Eclipse Oxygen onto a clean system that had never had Java installed on it before. This default everything with a brand new install of Eclipse Oxygen yet somehow or other Eclipse can't get its own parameters to match the jdk that's installed. This is the second project I created and the second time I ran into this headache. Time to go back to C#?

https://stackoverflow.com/questions/47876051/has-been-compiled-by-a-more-recent-version-of-the-java-runtime-class-file-versi/

Solution 3 - Java

You can try this way

javac --release 8 yourClass.java

Solution 4 - Java

53 stands for java-9, so it means that whatever class you have has been compiled with javac-9 and you try to run it with jre-8. Either re-compile that class with javac-8 or use the jre-9

Solution 5 - Java

For temporary solution just right click on Project => Properties => Java compiler => over there please select compiler compliance level 1.8 => .class compatibility 1.8 => source compatibility 1.8.

Then your code will start to execute on version 1.8.

Solution 6 - Java

I had a similar issue from the console after building a Jar in Intellij. Using the Java configuration to update to a newer version (Windows -> Configure Java -> Update -> Update Now) didn't work and stuck at version 1.8 (Java 8).

To switch to a more recent version locally I had to install the Java 15 JDK from https://www.oracle.com/uk/java/technologies/javase-jdk15-downloads.html and add that to my Java runtime environment settings.

Java Runtime Environment Settings

Solution 7 - Java

I'm writing this because I found the other answers hard to understand.

Essentially your JRE is not updated and/or Eclipse is not configured to use the most recent JRE.

On Windows, go to Control Panel -> Programs -> Java -> update and proceed to update java

or if you don't have Java, go to Oracle's website and download the most recent JRE.

Once this is done, go into eclipse, and under the project view, right click on your project, select Java Build Path, double click on JRE System Library, then Select Workspace Default JRE 14.1.

If a recent version of Java doesn't show up here, it probably isn't installed. Check you JRE(NOT JDK) version and make sure it's recent. If it is, try restarting the computer then trying this again.

Solution 8 - Java

Your JDK version: Java 8
Your JRE version: Java 9

Here your JRE version is different than the JDK version that's the case. Here you can compile all the java classes using JDK version 1.8. If you want to compile only one java class just change the *.java into <yourclassname>.java

javac -source 1.8 -target 1.8  *.java

source: The version that your source code requires to compile.
target: The oldest JRE version you want to support.

Solution 9 - Java

You might see this error in IntelliJ as well and this comes up in Google.

I think it's a Gradle error more than an IDE error.

The fix (stolen from here) is configure Java 11 as a Gradle JVM in IntelliJ:

File -> Settings -> Build, Execution & Development -> Build Tools -> Gradle and change Gradle JVM to 11

enter image description here

That screenshot stolen from the Jetbrains issue as well

Solution 10 - Java

IDE : Eclipse 2021-09

This is caused because you have compiled the code with java version 9 and have java8 installed. You don't have to update to solve this issue.

> Right click on project > properties > Java Compiler > untick-Enable > project specific settings > configure workspace settings > tick-Use > default compliance settings > Apply and Close.


Now your code should be executed properly.

Solution 11 - Java

Go to Project section, click on properties > then to Java compiler > check compiler compliance level is 1.8 , or there should be no yellow warning at bottom

Solution 12 - Java

Refreshing gradle dependencies works for me: Right click over the project -> Gradle -> Refresh Gradle Project.

Solution 13 - Java

You should check your Project Facets.

Project Properties > Project Facets

Change java version to the same version you are using. That work for me!

Solution 14 - Java

I faced this error in Intellij. Apparently, choosing java 1.8 as the project SDK doesn't affect the javac compiler that's used to build the project.

To change that, go to Settings -> Build, Execution, Deployment -> Compiler -> Java Compiler, and change Project bytecode version to 8.

Solution 15 - Java

This is getting as an example if your computer running on an older version of java and the Neo4J is compiled on the latest version, please try to install the same version or upper to your computer.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser5218071View Question on Stackoverflow
Solution 1 - JavaNithinView Answer on Stackoverflow
Solution 2 - JavaEric DView Answer on Stackoverflow
Solution 3 - JavaKrishna Santosh NidriView Answer on Stackoverflow
Solution 4 - JavaEugeneView Answer on Stackoverflow
Solution 5 - Javaakshay kenjaleView Answer on Stackoverflow
Solution 6 - JavaILallyView Answer on Stackoverflow
Solution 7 - JavaJacob WatersView Answer on Stackoverflow
Solution 8 - JavaINDRAJITH EKANAYAKEView Answer on Stackoverflow
Solution 9 - JavageorgiecaseyView Answer on Stackoverflow
Solution 10 - JavaTeja SaiView Answer on Stackoverflow
Solution 11 - JavaARVIND1994View Answer on Stackoverflow
Solution 12 - JavaCarlos CasallasView Answer on Stackoverflow
Solution 13 - JavaAgustin RodriguezView Answer on Stackoverflow
Solution 14 - JavaodnesView Answer on Stackoverflow
Solution 15 - JavaRajitha BhanukaView Answer on Stackoverflow