Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

0.20.2 API hadoop version with java 5

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.

like image 618
user360518 Avatar asked Jun 07 '10 15:06

user360518


1 Answers

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]

like image 123
Chris K Avatar answered Sep 26 '22 23:09

Chris K