If you are getting error Java.lang.UnsupportedClassVersionError Unsupported major.minor version 51.0 during compilation time
ErrorLog:-
ErrorLog:-
BUILD FAILED
java.lang.UnsupportedClassVersionError: in/cdac/mobile/computing/mtrans/MtransService : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at org.apache.tools.ant.AntClassLoader.defineClassFromData(AntClassLoader.java:1146)
at org.apache.tools.ant.AntClassLoader.getClassFromStream(AntClassLoader.java:1324)
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1388)
Total time: 1 second
Solution:-
Check your java versionIn Unix type command : java -verionjava version "1.6.0_30"Java(TM) SE Runtime Environment (build 1.6.0_30-b12) Java HotSpot(TM) Client VM (build 20.5-b03, mixed mode, sharing)
java.lang.UnsupportedClassVersionError
occurs because of a higher JDK during compile time and lower JDK during runtime.
The version number shown describe which version if Java was used to compile the code.
The reported major numbers are
J2SE 7 = 51, J2SE 6.0 = 50, J2SE 5.0 = 49, JDK 1.4 = 48, JDK 1.3 = 47, JDK 1.2 = 46, JDK 1.1 = 45
Follow these stepProject -> Properties -> Java CompilerEnable project specific settings.Then select Compiler Compliance Level to 1.7,1.6 or 1.5, build and test your app.