0.20.2 API与Jav​​a 5的hadoop版本 [英] 0.20.2 API hadoop version with java 5

查看:97
本文介绍了0.20.2 API与Jav​​a 5的hadoop版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始一个maven项目,试图在java 1.5.0_14中实现MapReduce算法。我选择了0.20.2 API hadoop版本。在我使用的pom.xml中,因此具有以下依赖性:



<依赖关系>

 <的groupId> org.apache.hadoop< /&的groupId GT; 
<的artifactId> Hadoop的核心< / artifactId的>
<版本> 0.20.2< /版本>

< / dependency>



但是当我使用一个导入到org.apache.hadoop类时,出现以下错误:



错误的类文件:$ {HOME_DIR} \repository\org\apache\hadoop\hadoop-core\0.20.2\hadoop-core-0.20.2.jar (org / apache / hadoop / fs / Path.class)
类文件错误版本50.0,应该是49.0



有人知道如何解决这个问题。



谢谢。 Maven 解析方案

Maven默认编译为JDK 1.4兼容性。您需要更改此设置。



您需要将其添加到您的pom.xml中:

 <插件> 
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-compiler-plugin< / artifactId>
< version> 2.0.2< / version>
<配置>
< source> 1.6< / source>
< target> 1.6< / target>
< / configuration>
< / plugin>


I have started a maven project trying to implement the MapReduce algorithm in java 1.5.0_14. I have chosen the 0.20.2 API hadoop version. In the pom.xml i'm using thus the following dependency:

< dependency>

< groupId>org.apache.hadoop< /groupId>      
< artifactId>hadoop-core< /artifactId>      
< version>0.20.2< /version>

< /dependency>

But when I'm using an import to the org.apache.hadoop classes, I get the following error:

bad class file: ${HOME_DIR}\repository\org\apache\hadoop\hadoop-core\0.20.2\hadoop-core-0.20.2.jar(org/apache/hadoop/fs/Path.class) class file has wrong version 50.0, should be 49.0.

Does someone know how can I solve this issue.

Thanks.

解决方案

Maven by default compiles to JDK 1.4 compatibility. You need to change this.

You need to add this to your pom.xml:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.0.2</version>
    <configuration>
        <source>1.6</source>
        <target>1.6</target>
    </configuration>
</plugin>

[Edit: thank you Sean for pointing out Hadoop requires JDK 6]

这篇关于0.20.2 API与Jav​​a 5的hadoop版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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