Debashisenator
Debashisenator

Reputation: 1739

Compile error in WordCount.java with CDH4 pseudo distributed mode

I have just copied the WordCount.java source code from the examples directory and I am trying to compile it. But I am getting the error

WordCount.java:61: error: cannot access Options
String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
                     ^
class file for org.apache.commons.cli.Options not found
1 error

I have not changed anything in the code.

Upvotes: 2

Views: 3509

Answers (3)

Saurabh
Saurabh

Reputation: 508

Add commons-cli-1.2.jar to your project. Right-click on your project and choose build path -> configure build path and then choose the library from Hadoop-2.5.0-cdh5.3.2\share\hadoop\common\lib.

Upvotes: 0

Poornima singh Thakur
Poornima singh Thakur

Reputation: 11

hadoop common cli is present in the lib folder.

Please go through the following command:

javac -classpath hadoop-core-1.0.3.jar:lib/commons-cli-1.2.jar -d tmp/playground/classes tmp/playground/src/WordCount.java

Upvotes: 1

Jerry Ragland
Jerry Ragland

Reputation: 621

Add commons-cli-1.2.jar to your classpath. Download it from Apache link if you don't see it on your local machine.

Upvotes: 5

Related Questions