Problem: On running the mapreduce jar, getting below exception
Exception in thread "main" java.lang.UnsupportedClassVersionError:
jobname : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
Reason
This error occurs if the jar is compiled with a version higher than the version where it isdeployed
Solution
1. Check current version of java by using the below command:
$ java -version
2. Get that java version installed in your machine.
3. Go to Project > Properties > Project Build Path > Edit Jre > Select Alternate Jre
4.Go to Project > Properties > Java Compiler > Select Enable Project Specific Settings > Change the Compiler Compliance Level
5. Create the jar again and deploy. It must work fine. :)