Reputation: 1869
I am trying to run the WordCount example on hadoop - 1.0.4 and I am getting the following error:
Exception in thread "main" java.lang.UnsupportedClassVersionError: WordCount :
Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.apache.hadoop.util.RunJar.main(RunJar.java:149)
I use the following java version:
java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) Server VM (build 23.6-b04, mixed mode)
Also JAVA_HOME indicates to the java7 installation directory.
Thanks for your help.
Upvotes: 23
Views: 45816
Reputation: 111
I also encountered the same problem.Should use same JAVA version for compile and same or greater on where you are executing it although vice-versa cause this error. If you checked:
Window > Preferences > Compiler > compiler level
java -version
and both has same version then you are good to go.
While creating New Project in Eclipse:
File -> New -> Java Project
under JRE check Use an execution environmentUpvotes: 0
Reputation: 41
I had the same problem which I solved. I found that
the JAVA_HOME
in my hadoop-env.sh
is /usr/lib/jvm/java-6-openjdk
but the JAVA_HOME
in /etc/profile
is /usr/local/java/jdk1.8.0_25
.
After I change JAVA_HOME
in /etc/profile
to /usr/lib/jvm/java-6-openjdk
which is the same as hadoop-env.sh
and use
$source /etc/profile # to make /etc/profile effects
My problem is solved! I hope this will help you.
Upvotes: 4
Reputation: 762
I think you already got your answer ..just to add, in eclipse under project there is a JRE System Library [JavaSE-1.x] folder .. right click on it you will see JRE System Library screen..there you can set the execution environment.
Upvotes: 0
Reputation: 41
The problem is due to .jsp files are getting compiled with higher compiler(8) than expected(7). Change all compilation levels to lower one(i.e. 7) also change the jdk path given in eclipse configuration settings file in the same folder where .exe is located.
Upvotes: 0
Reputation: 121998
Seems like you are using JDK8 for compiling and Lower version on Where you are using it.
So
Assuming using eclipse, Window > Preferences > Compiler > compiler level
and then set lower level(< current one ).
Upvotes: 19
Reputation: 3462
Well obviously that won't work! You are compiling on a newer JDK and deploying on an older JDK / JRE. You need to compile on the older JDK.
Upvotes: 0
Reputation: 77187
Looks like someone managed to compile a class with a Java 8 compiler. Recompile the offending jar with a compliance level of Java 7 or lower.
Upvotes: 0