我尝试运行示例wordcount程序,我的hdfs文件保存在/input中,输出目录是/output,下面是我执行的命令:
[hadoop-2.2.0]$ bin/hadoop jar $HADOOP_HOME/share/hadoop/mapreduce/sources/hadoop-mapreduce-examples-2.2.0-sources.jar org.apache.hadoop.examples.WordCount /input /output
但我有以下错误:
Exception in thread "main" java.lang.ClassNotFoundException: org.apache.hadoop.examples.WordCount
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at org.apache.hadoop.util.RunJar.main(RunJar.java:205
2条答案
按热度按时间nafvub8i1#
我想那是因为你用的是源文件。您更希望执行$hadoop\u home/share/hadoop/mapreduce/sources/hadoop-mapreduce-examples-2.2.0.jar。也许会有帮助。
icomxhvb2#
试试hadoop-mapreduce-examples-2.2.0.jar
如果确实要使用源jar,可以先运行以下命令: