Question

I am very new to Hadoop. I set up the single node cluster hadoop-1.0.4, I also dl the jar of the examples - hadoop-exaples-1.0.4.jar from apache hadoop web. Using the jar and the command "hadoop jar hadoop-examples-1.0.4.jar wordcount 'input-dir' 'output-dir'" I am able to run the simple wordcount problem.

The Problem :: now I copy the code of the wordcount problem found in the apache hadoop web site, into eclipse and export a jar file which now contains only WordCount class and i rename the jar as wc.jar BUT now using the same command "hadoop jar wc.jar wordcount 'input-dir' 'output-dir' " ... it is giving the error :: "Exception in thread "main" java.lang.ClassNotFoundException: WordCount " .... I rechecked the code and make sure that the class name is WordCount...but it is still giving the same error.... I am totally confused what to do ?? Hope you can help. Here is link of code that i used to make jar .... http://wiki.apache.org/hadoop/WordCount

Was it helpful?

Solution

Try with the package path:

hadoop jar wc.jar org.myorg.WordCount 'input-dir' 'output-dir' 

OTHER TIPS

I add :

 job.setjarByClass(org.myorg.WordCount.class);

and run by the command like Erik said:

 hadoop jar wc.jar org.myorg.WordCount 'input-dir' 'output-dir' 

It worked !!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top