Reputation: 363
When I try running my java .jar on another machine I get the error
Unsupported major.minor version 52.0
I compiled my program using the jdk 1.6 and my machine (separate one) has java 7 installed.
This is the java version my machine is running:
Here are the settings in my IDE (Eclipse Lunar)
Why am I still getting an unsupported error?
I did check my run configuration and change it to jre6, but when I do I can't even run my program in the IDE.
Note: I would like my program to work with jdk 6, if that is not possible jdk 7.
My Class Path:
Upvotes: 35
Views: 131826
Reputation: 1144
I had the same issue. Turned out I used some external jars (apache poi 4.1.2) which were compiled with 1.8. Solved it by changing Java Build Path JRE to 1.8.
Upvotes: 0
Reputation: 3042
I also had to update the version of Tomcat I was using from Tomcat 7 to Tomcat 8.
Upvotes: 0
Reputation: 786
If you are trying to execute your program/application from the command prompt. Just make sure to restart your cmd after you have changed the JAVA_HOME var. Very simple but easily missed sometimes.
Upvotes: 1
Reputation: 690
I had also same issue. I solved this problem by updating my system jdk. Previously i used jdk7.0 and now it is updated to jdk8.0. find below link to download the updated jdk with new version. it help me to solve my problem.
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Upvotes: 0
Reputation: 1210
First of all thank you for all above answers. However, I use Intellij Idea for daily basis. So, I hope my answer will help others.
Run your favourite terminal or command line. Then check your java version by running command
java -version
Then in Intellij press
Ctrl+Alt+Shift+S
in the
Project Settings
tab under
Project SDK
choose appropriate java version. Lastly, rerun your code.
Upvotes: 0
Reputation: 1
Right Click on Project, Properties ---> Java Compiler ( on same page change compiler Compliance Level to 1.6 (or) 1.7 (or) 1.8 ( match with your JAVA_HOME)
Upvotes: 0
Reputation: 51
I Encounter similar issue while doing development on Android Studio 2.2.
My Machine Configuration -
I then made below changes - 1. Uninstall JDK 1.7.0_79 2. Updated JAVA_HOME = 1.8.0_101 JDK path (Similar to SDK Location)
Now i am able to compile and run my application successfully , no more Unsupported major.minor version 52.0 Error
Upvotes: 2
Reputation: 482
Hi I found this link that helped me understand the issue. Hope it is useful. Version released so far are
and from thata data it simply means
Many people think why do you get a version mismatch error if Java is backward compatible. Well, its true that Java is backward compatible, which means you can run a Java class file or Java binary (JAR file) compiled in lower version (java 6) into higher version e.g. Java 8, but it doesn't mean that you can run a class compiled using Java 7 into Java 5, Why? because higher version usually have features which are not supported by lower version.
Sometimes you may have more than one version of Java installed in you machine. Make sure the application you are running is pointing to the right or highest version available.
Upvotes: 14
Reputation: 9
Its a silly problem, just make sure that the jdk and jre are latest version. This problem mainly occurs due to the automatic update of java(jre) and the jdk is not supported to that version, this makes problem.
Upvotes: 0
Reputation: 9212
Are you using retrolambda? If so, just do JAVA_HOME=$JAVA8_HOME
.
Source: https://github.com/evant/gradle-retrolambda/issues/74
Upvotes: 0
Reputation: 31
The error happens when you have compiled with higher version of Java and it is been tried to run with lower version of JRE. Even with minor version mismatch you would have this issue
I had issue compiling with JDK 1.8.0_31 and it was run with jdk1.8.0_25 and was displaying the same error. Once either the target is updated to higher version or compiled with same or lesser version would resolve the issue
Upvotes: 0
Reputation: 2865
Several possiblies that causes this problem. The root cause is mismatched of compiler version between projects and IDE. For windows environment you can refer to this blog to do the detail troubleshooting.
Upvotes: 0
Reputation: 761
I agree with chrylis: you believe you changed your project's compliance settings but probably you didnt.
Right click on your project and:
By the way you can "tell" eclipse that jre8 is 1.6 compliance clicking on Window/Preferences/Java/Installed JREs/Execution Environment and selecting in the left panel, Execution Environments, JavaSE-1.6 and in the Compatible JRE's panel, jre8
Upvotes: 33