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)

3 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.

0

Unsupported major.minor version error is because of Java version mismatch. It happens when you compile your projects on higher version of java(e.g. jdk 1.8) and then run it on a lower version (e.g. jdk 1.7). Depending on your situation, you have two ways to resolve this error: compile your code for an earlier version of Java, or run your code on a newer Java version. Sometimes you may have more than one version of Java SDK installed in your machine. Make sure the application you are running is pointing to the right or highest version available . It is better you need to install both JRE/JDK with the same version.


 

Your Answer

Click on this code-snippet-icon icon to add code snippet.

Upload Files (Maximum image file size - 1.5 MB, other file size - 10 MB, total size - not more than 50 MB)

Email
Password