Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top