HADOOP::java.lang.ClassNotFoundException:WordCount… here is a solution to the problem.
HADOOP::java.lang.ClassNotFoundException:WordCount
I’m using Eclipse to export the JAR file for the Map-Reduce program. When I run jar with the 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)
By the way, I got a wordcount example jar file from the internet and it works just fine.
I can’t think of a problem.
Solution
If you try to run the word count provided in the example, you should run:
hadoop jar hadoop*examples*.jar wordcount /home/temp/input /home/temp/output
How to use this in More information on running wordcount on this link
In general, if you’re developing your own Map/Reduce job, 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