Java incompatibility

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(
at java.lang.ClassLoader.defineClass(
at Method)
at java.lang.ClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(
at org.apache.hadoop.util.RunJar.main(

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)


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.


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

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.


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)