码迷,mamicode.com
首页 > 编程语言 > 详细

HADOOP :: java.lang.ClassNotFoundException: WordCount

时间:2014-12-17 14:31:34      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:http   ar   io   sp   for   java   on   bs   ad   

I am using eclipse to export the jar file of a map-reduce program. When i am run the jar using command

 hadoop jar hadoop-prog.jar WordCount /home/temp/input /home/temp/output

it always shows the error :

   Exception in thread "main" java.lang.ClassNotFoundException: WordCount
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:149)

Btw, I get a sample example jar file of wordcount from internet and it ran very well.

I could not figure out where is the problem.

 

答案

If you‘re trying to run the wordcount provided in the examples, you should run:

hadoop jar hadoop*examples*.jar wordcount /home/temp/input /home/temp/output

More info on how to run wordcount on this link.

In general, if you‘re developing your own Map/Reduce jobs, you should include the full package name of your driver class, so something like this might work:

hadoop jar wordcount.jar com.something.WordCount /home/temp/input /home/temp/output

HADOOP :: java.lang.ClassNotFoundException: WordCount

标签:http   ar   io   sp   for   java   on   bs   ad   

原文地址:http://www.cnblogs.com/sidesky/p/4169149.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!