My JDK version is jdk1.8.0_45 and I have built an application using the default JDK Compliance setting in eclipse.
But my colleague is having a JRE with version jre1.8.0_20. So when my application is run in his system, it is throwing an
java.lang.UnsupportedClassVersionError Unsupported major.minor version 52.0
If I build the application with JDK compliance set to 1.7, it works fine obviously. But I don't want to lose all the features of JDK 8 just for a minor version mismatch.
And in eclipse I am not able to set a minor version compliance level. Is it possible to set it???
Or is Java forward compatible with minor version releases?? If so, obviously this error should not occur I believe.
Configure the default JRE Download and install a Java JDK v1. 7 or greater. Set it as the default in Eclipse by selecting Preferences -> Java -> Installed JREs. Add the installed JDK and select the checkbox, making it the default.
According to this Version 52.0 is JDK-8. It seems that its a Number compiled into the .class files depending on the JDK. JDK-7 has 51, JDK-6 has 50 etc.
I would state the execution on your collegue's machine didn't use a JDK/JRE 8.
Try running java -XshowSettings
on your collegues pc and check the output of the line java.class.version
- if its a JDK 7 it will show java.class.version = 51.0
.
You should be specifying a runtime "Execution-environment" version dependency rather than a specific java version.
For a plugin, in the manifest.mf, specify execution environment: JavaSE-1.8
For a plain java project, in "Build Path...->Configure BuildPath" go to "Libraries" then "Add Library", "JRE System Library", "Execution Environment" and select JavaSE-1.8. Remove any other JRE on path.
This says to eclipse, find a Java >= 1.8 compliant JRE.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With