We will be receiving this error mainly because while making the jar you might have not selected the class having the Main Method.


To avoid this error there are two ways:


First One:


Please follow the below steps while making the jar.


  • Right Click on Project->Select the option Export ->Click on Next. 
  • Give the name of the jar and click on Next.
  • Click on Next. 
  • Click on Browse option and select the class having the Main Method and click on OK.
  • And finally click on Finish

Transfer the file to respective location and then run it.

E.g: hadoop jar wordcount.jar  /input.txt /output

Second One:


We have another way in order to solve this issue.


In such cases you can give the class name along with the Package Name having the Main Method directly in the command.


E.g: hadoop jar wordcount.jar  com.edureka.mapreduce.WordCount  /input.txt /output


Note: In the above command  com.edureka.mapreduce is the package name and WordCount is name of the class having the Main Method.


You may refer to the document attached that would guide you about this error with the help of screenshots.


Please feel free to revert if you need any further help.