Shailendra Kumar
Shailendra Kumar

Reputation: 1

Unable to execute the program in hadoop

When I created a Jar and compiled in windows and tried to run in Hadoop. It's throwing an error while running this script

admin1@admin1:/usr/local/hadoop/conf$ hadoop jar wordcount.jar com.shailu.wordcount.WordCount input/wordcount output/wordcount

Error is:

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/shailu/wordcount/WordCount : Unsupported major.minor version 52.0

Upvotes: 0

Views: 50

Answers (2)

Guo
Guo

Reputation: 1803

I have encountered such problem. You need keep the compiler consistently between windows and hadoop or hadoop compiler higher than windows'. See picture I screenshot from Internet(contain a little Chinese, you also can refence this website if you can open it: JDK compiler version mapping minor.major). I guess JDK1.8.x is mapping major.minor version 52.0. Picture of JDK compiler version mapping minor.major

JDK编译器版本-------------JDK compiler version
target参数----------------target parameter
十六进制 minor.major------hexadecimal minor.major
十进制 minor.major--------decimal minor.major
不能带 target 参数--------can't add target parameter
默认为--------------------default

Upvotes: 0

user3123372
user3123372

Reputation: 744

Nothing wrong with ur execution,

Looks like there is a mismatch in the compile and the execute environment. type "java -version" in both the environments , i.e. windows and hadoop(linux/unix)

My doubt is you have compiled the code in a higher version like 1.8, change it to 1.7 or so, you should be ok.

or while compiling choose the same java version as the hadoop environment have.

Upvotes: 3

Related Questions