2014-01-10 56 views
2

我刚从示例目录中复制了WordCount.java源代码,我试图编译它。但我得到我还没有在代码改变任何东西的错误用CDH4伪分布式模式在WordCount.java中编译错误

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 

+2

您是如何编制的?你显然需要在你的班级路径 – unekwu

+0

中包含cli库,那么我们如何使用命令行 –

回答

4

commons-cli-1.2.jar添加到您的类路径中。如果您没有在本地机器上看到它,请从Apache link下载它。

+0

来优化它?请告诉我什么是命令行 –

0

hadoop common cli存在于lib文件夹中。

请通过以下命令:

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