MapReduce打包程序运行错误——Unsupported major.minor version 51.0解决办法

编译运行打包的MapReduce程序时,报如下错误:

[root@hadoop1 bin]# yarn jar /home/czt/ocf_3h-0.0.1-SNAPSHOT-package.jar 105096 3 10 station @ 0 /czt/data/WMCF_OCF_LST_3H2015020612.DAT pmsc_fine_3h_15day
Exception in thread "main" java.lang.UnsupportedClassVersionError: gov/cma/all/DataUploader : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
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:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:249)
at org.apache.hadoop.util.RunJar.main(RunJar.java:205)

出现如上原因是因为打包的jar包的 jdk版本与系统的版本不一致造成的,解决方法是重新导入jar的源码,选择好对应的版本之后重新打包


你可能感兴趣的:(MapReduce)