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, 2019 in Big Data Hadoop by digger
• 26,740 points
3,339 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, 2019 by Omkar
• 69,220 points

Related Questions In Big Data Hadoop

+1 vote
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,490 points
1,273 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 15, 2019 in Big Data Hadoop by John
873 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
26,645 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
• 11,380 points
17,175 views
+1 vote
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
• 11,380 points
11,072 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
• 11,380 points
2,571 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
109,058 views
–1 vote
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,350 points
4,639 views
0 votes
1 answer

Unable to execute HDFS commands on the terminal

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

answered Feb 7, 2019 in Big Data Hadoop by Omkar
• 69,220 points
2,175 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 12, 2019 in Big Data Hadoop by Omkar
• 69,220 points
1,611 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP