Seems like the jar file was not exported properly. Did you export the jar by yourself or copied from somewhere? This is one of the many reasons for this error. Anyways, you can follow the below mentioned steps to run the MapReduce program:
1) Write the program in eclipse,
2) Create a jar file of this program,
Now, you will have the jar file in the local file system of your System.
3) Make sure that you have the input dataset in the hdfs,
4) Execute the Hadoop jar command.
The syntax to execute the hadoop jar command is as below,
hadoop jar <jarfilename.jar> <packagename.classname> <inputfile> <outputpath>
We will execute the below command for our program,
hadoop jar WordCount.jar co.edureka.WordCount wordcountproblem WordCountOutput
![image](https://attachment.freshdesk.com/inline/attachment?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6NDA1OTkwOTI4OCwiZG9tYWluIjoiZWR1cmVrYS5mcmVzaGRlc2suY29tIiwiYWNjb3VudF9pZCI6NDE0NTN9.K3SB6JU_Dca6xwCNhWj1zcX4SUyqd7qAfIKbSuQPY_w)
This will create a directory in hdfs named WordCountOutput and this directory will contain the output of our program,
5) Check the output.
The syntax to check the contents of a file in hdfs is as below,
hdfs dfs -cat <path/filename>
We will check the output of our program with the below command,
hdfs dfs -cat WordCountOutput/part-r-00000
You can see that it works without error.