Search code examples
javahadoopclouderaword-count

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.


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.