你好,游客 登录 注册 搜索
背景:
阅读新闻

Hadoop编译WordCount程序:class file for org.apache.commons.cli.Options no

[日期:2013-01-24] 来源:Linux社区  作者:warmspace [字体:大 中 小]

Hadoop问题:编译WordCount程序报错:class file for org.apache.commons.cli.Optio

第一次编译Hadoop的程序,将安装程序自带的WordCount程序拿出来编译执行,编译时遇到如下错误:

Ubuntu@ubuntu:~/dev/wordcount$ javac -classpath /home/ubuntu/hadoop-1.0.4/hadoop-core-1.0.4.jar -d bin WordCount.java
WordCount.java:53: cannot access org.apache.commons.cli.Options
class file for org.apache.commons.cli.Options not found
    String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
                        ^
1 error

在网上搜索了一下,找到了原因,在 classpath 中再加上一个 jar 包即可:

ubuntu@ubuntu:~/dev/wordcount$ javac -classpath /home/ubuntu/hadoop-1.0.4/hadoop-core-1.0.4.jar:/home/ubuntu/hadoop-1.0.4/lib/commons-cli-1.2.jar -d bin WordCount.java
ubuntu@ubuntu:~/dev/wordcount$ ls bin/*.class
bin/WordCount.class  bin/WordCount$IntSumReducer.class  bin/WordCount$TokenizerMapper.class

 

linux
相关资讯       WordCount  Hadoop编译 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款