JAVA运行时错误:java.lang.UnsupportedClassVersionError。不受支持的major.minor版本51.0 [英] JAVA runtime error: java.lang.UnsupportedClassVersionError. Unsupported major.minor version 51.0

查看:92
本文介绍了JAVA运行时错误:java.lang.UnsupportedClassVersionError。不受支持的major.minor版本51.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图运行PUMA基准测试套件(Purdue Mapreduce Benchmarks Suite:用于hadoop)。我正确运行了一个应用程序(wordcount),但无法运行另一个应用程序(invertedindex)。错误发生在运行时,它说



线程main中的异常java.lang.UnsupportedClassVersionError:org / apache / hadoop / examples / InvertedIndex:不受支持major.minor版本51.0



我搜索了一下,发现它是因为java版本。我检查了Java版本并重新编译代码,然后运行它。但仍然在运行时发生的inverseindex应用程序和wordcount应用程序的运行情况良好。

  $ java -version 
java版本1.7.0_51
Java™SE运行时环境(内部版本1.7.0_51-b13)
Java HotSpot™64位服务器虚拟机(版本24.51-b03,混合模式)
$ javac -version
javac 1.7.0_51

我该如何解决这个问题?这个错误是由源代码引起的吗?

解决方案

使用java -version获得的java版本不反映您的hadoop的java版本。

检查你的hadoop的Java版本,使用命令hadoop classpath并检查它指向的jdk目录。或者你可以去hadoop / config / hadoop-env.sh找到它。

您的问题最有可能通过将hadoops的java主页指向jdk 1.7来解决。你可以在hadoop-env.sh中再次编辑它。

I'm trying to run PUMA benchmark set(Purdue Mapreduce Benchmarks Suite: for hadoop). I ran one application(wordcount) appropriately but couldn't run the other one(invertedindex). Error occures at runtime and it says

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/hadoop/examples/InvertedIndex : Unsupported major.minor version 51.0

I googled and found that it's because of the java version. I checked the java version and recompile the code and then run it. But still the same error occured at runtime for invertedindex application and wordcount application works well.

$ java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
$ javac -version
javac 1.7.0_51

How can I resolve this problem? Can this error be caused by source code?

解决方案

the java version you obtain with java -version is not reflective of your hadoop's java version.

to check your hadoop's java version, use command hadoop classpath and check the directory of jdk it points to. or you could go to hadoop/config/hadoop-env.sh to find it.

your problem will most likely be solved by pointing hadoops's java home to jdk 1.7. you can edit this again in hadoop-env.sh.

这篇关于JAVA运行时错误:java.lang.UnsupportedClassVersionError。不受支持的major.minor版本51.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆