Today I was bitten by a wrong compiler setting and the infamous UnsupportedClassVersionError
:
Caused by: java.lang.UnsupportedClassVersionError: org/eclipse/virgo/management/console/internal/Parser : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
With the help of Stackoverflow "What version of javac built my jar?" I was able to verify the problem:
$ unzip org.eclipse.virgo.management.console_3.7.0.D-20150619091013.jar
$ javap -v org.eclipse.virgo.management.console.internal.Parser | grep major
major version: 51
I wonder whether it is possible to get the version of javac used to compile the jar without this magic mapping table:
major.minor | Java version |
---|---|
49.0 | Java 5 |
50.0 | Java 6 |
51.0 | Java 7 |
52.0 | Java 8 |