0
votes

What could be the reason for the error? I am able to successfully compile on mac eclipse. But not on hadoop server which is running CDH4.

root@hadoop]# javac -cp /usr/lib/hadoop/hadoop-common.jar:/usr/lib/hadoop/client-0.20/commons-cli-1.2.jar:/usr/lib/hadoop/client-0.20/hadoop-core-2.0.0-mr1-cdh4.1.3.jar WordCount.

1. ERROR in WordCount.java (at line 12)
public static class Map extends MapReduceBase implements Mapper <LongWritable, Text, Text, IntWritable> 

The type Mapper is not generic; it cannot be parameterized with arguments < LongWritable, Text, Text, >

2. ERROR in WordCount.java (at line 12)
public static class Map extends MapReduceBase implements Mapper <LongWritable, Text, Text, IntWritable> {

Syntax error, parameterized types are only available if source level is 5.0

1
Would you mind showing us your code and the imports?Thomas Jungblut

1 Answers

1
votes

It seems that you have mixed some older version of Hadoop with the newer one. Also, you have used the older mapreduce API i. mapred. I would suggest you to re-write the program using the newer API i.e mapreduce without mixing the jars of older hadoop version with a newer version.

Also, it looks like you are trying to use the jre which is different from the one Eclipse is configured to use. Use java -version to check which version of java is installed on your machine and change the Eclipse preference accordingly. You can do that by going to

Window > Preferences > Java > Installed JRE’s

HTH