Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/prefs/AndroidLocationsProvider has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
I tried also JDK 11 but it doesn't works.
How do I fix?
This error is telling us that our class was compiled at a higher version of Java than the version with which we tried to run it. More specifically, in this case we compiled our class with Java 11 and tried to run it with Java 8.
we have two ways we can resolve this error: compile our code for an earlier version of Java, or run our code on a newer Java version.
I think this website might help you https://www.baeldung.com/java-lang-unsupportedclassversion
Related
my eclipse editor had an error in the last 2 days, but never before. It says
java.lang.UnsupportedClassVersionError: com/pluginswithalfa/java/takeinandout has been compiled by a more recent version of the Java Runtime (class file version 59.0), this version of the Java Runtime only recognizes class file versions up to 53.0
I use MacOS and i am a newbie could someone please help me
This is my first application that i try to execute exe.
I'm using launch4j to do this. After executing and trying to run, I get this error:
Blockquote
Launch4j - Exception in thread "main" java.lang.UnsupportedClassVersionError: FakeMain has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
I searched something about versions of java, so I checked my versions of java and they are the same.
That's my versions of java:
My versions of java in cmd
Maybe I did something wrong there?
Screen of Launch4j
I don't know what I can do. I spend all this day about fix this and nothing.
Error after try to run exe file
You have compiled the code with Java 11 as target. But your PC want's to execute the Java Code with Version 8, which is not possible.
Make sure you have installed the correct Versions and also make sure that the executable uses Java 11.
Here you can find the Java Versions mapped to the Runtime Versions: Java Version Numbers
The Article gives you also some information about how to compile and execute for the correct versions.
I wanted to use JavaFX to start doing an interface to my app but I get error:
java.lang.UnsupportedClassVersionError: org/openjfx/gradle/JavaFXPlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
> org/openjfx/gradle/JavaFXPlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Can someone please explain me how to fix it for IntelliJ Idea?
Thank you!
It says that your current version of Java only recognises class file version up to 52.0. This means you have Java 1.8 (version 8) installed on your system.
Simply install Java version 11 to remove the error. Or if you already have Java 11 installed, then check your project's JDK path and make sure that you've configured JDK 11.
Check this out for step by step solution on Eclipse IDE
In my past computer science classes, we did all of our work inside Eclipse. Now, I am trying to compile and run java programs using the PowerShell. I am able to compile using javac, but when I try to run the class file with the main method I get the following error
Error: A JNI error has occurred, please check your installation and
try again Exception in thread "main"
java.lang.UnsupportedClassVersionError: HW has been compiled by a more
recent version of the Java Runtime (class file version 56.0), this
version of the Java Runtime only recognizes class file versions up to
52.0
The program I am trying to run to test this out is just a hello world program.
My versions of Java are Java 8 Update 251(64-bit) and Java SE Development Kit 12.0.2 (64-bit). Are these mismatched in any way or are there any other issues it could be?
C:\Users\YusufGalip\Desktop\JavaDeneme>java deneme
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: deneme has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
I got this error when i tried to run a compiled program.
It's probably compiled with a more recent version of java than the one you are attempting to use running the program. Do you have multiple versions of Java installed?
Try java -version and javac -version and compare the versions. If you use and IDE/editor where Java is configured in the settings, see that it points to the expected directory.
You've compiled your class with Java 11 (55) while you're still trying to execute/run them using Java-8(52).
Either compile the code using Java-8 or execute with Java-11.
The error clearly says that the compiler version was higher than the JVM version with which you are trying to run. That is why you are getting the error on running.
Java 8 uses major version 52
Java 11 uses major version 55
Reference:
https://en.wikipedia.org/wiki/Java_class_file#General_layout
=================
#DO THE FOLLOWING
change your path to point to a more recent version or if you are aware of the version using which the program was compiled, install the version and then execute the same command to run
1) run java -version now
2) Note down the version
3) complete the above #DO ****
4) execute 1) again
5) you should see a different or the latest version
6) run your program :) and you should be able to .... post your results
Finally I solved with your help.
There were 2 Java in my computer one of them is "Java SDK Tools 11" and the second one is "Java Runtime 8" I uninstalled the "Java Runtime 8" and it worked.Thank you for your help.