Unable to execute the jar file wordcount.

–1 vote

I am trying to execute word count jar file in my system. I am using the following command:

$ hadoop jar WordCountAssignment.jar WordCount /user/hduser/wordcountproblem /user/hduser/wordcountproblemSol

But I am getting this error:

Exception in thread "main" java.lang.ClassNotFoundException: WordCount
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:214)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Jan 21 in Big Data Hadoop by digger
• 26,550 points
200 views

1 answer to this question.

0 votes

I see that the command that you are using has only input path where your data set is present and an output path but you have not mentioned your package name along with the class name. So, It was unable to locate the class. 

The command is as below for executing map reduce codes:

hadoop jar wc.jar practice.word_count wordcountproblem /user/hduser/wc_mr

Where wc.jar is the name of the jar that you export from eclipse, practice is the name of the package in which we have the class, this can differ if you have a different class name, word_count is the class name in which you have the code for word counting, wordcountproblem is the data set that you have transferred  to hdfs. This may change depending on the exact path of your data set in the hdfs.

answered Jan 21 by Omkar
• 67,660 points

Related Questions In Big Data Hadoop

0 votes
1 answer

Why is jar file required to execute a MR code instead of class file?

We use hadoop keyword to invoke the ...READ MORE

answered Apr 24, 2018 in Big Data Hadoop by Shubham
• 13,310 points
61 views
0 votes
1 answer

Failing to execute the script pig file on HDFS

By convention, the pig script that you ...READ MORE

answered Feb 14 in Big Data Hadoop by John
80 views
0 votes
7 answers

How to run a jar file in hadoop?

I used this command to run my ...READ MORE

answered Dec 10, 2018 in Big Data Hadoop by Dasinto
6,117 views
0 votes
1 answer

Copy file from HDFS to the local file system

There are two possible ways to copy ...READ MORE

answered Mar 27, 2018 in Big Data Hadoop by nitinrawat895
• 10,730 points
6,454 views
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,730 points
3,371 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,730 points
406 views
0 votes
10 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
16,762 views
0 votes
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,260 points
1,225 views
0 votes
1 answer

Unable to execute HDFS commands on the terminal

Maybe because you have not started hadoop ...READ MORE

answered Feb 6 in Big Data Hadoop by Omkar
• 67,660 points
34 views
0 votes
1 answer

Error while hitting the hadoop jar command to execute my map reduce

Since your jar file was inside the ...READ MORE

answered Feb 11 in Big Data Hadoop by Omkar
• 67,660 points
92 views