Java incompatibility



0
Hi I compiled the WordCount program in Windows 7 environment.

C:\Users\101264>java -version
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)

But I am getting the following error for CDH3.

cloudera@cloudera-vm:~/class3$ hadoop jar myWordcount.jar com.eng.demo.WordCount /user/cloudera/class3/wc-input /user/cloudera/class3/wc-output

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/eng/demo/WordCount : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.apache.hadoop.util.RunJar.main(RunJar.java:179)

cloudera@cloudera-vm:~/class3$ java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)

2 Answer(s)


0

Straight forward, java in cdh3 is different version To that od default environment in eclipse. You will have a feature in eclipse (windows 7) to set environment to required version.

0

hi Muralushanar,
Looks like there is a difference between the java you used for compilation and the java with which you are trying to execute. Please look here -> http://stackoverflow.com/questions/22489398/unsupported-major-minor-version-52-0

Solution is to update to latest java 7 , use it to compile and execute it. Also note that CDH3 is not supported, better to upgrade to CDH4.