我尝试运行示例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
答案 0 :(得分:0)
尝试hadoop-mapreduce-examples-2.2.0.jar
bin/hadoop jar $HADOOP_HOME/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.2.0.jar wordcount /input /output
如果你想使用源jar,你可以先在下面运行:
unset HADOOP_CLASSPATH
答案 1 :(得分:0)
我认为那是因为您使用的是源文件。你宁愿执行$ HADOOP_HOME / share / hadoop / mapreduce / sources / hadoop-mapreduce-examples-2.2.0.jar 代替。也许它会有所帮助。