Hadoop Java Error : Exception in thread “main” java.lang.NoClassDefFoundError: WordCount (wrong name: org/myorg/WordCount)

前端 未结 6 2461
别那么骄傲
别那么骄傲 2021-02-14 10:42

I am new to hadoop. I followed the maichel-noll tutorial to set up hadoop in single node.I tried running WordCount program. This is the code I used:

import java.         


        
6条回答
  •  孤独总比滥情好
    2021-02-14 11:01

    I think you made a mistake here :

    /usr/local/hadoop$ bin/hadoop jar wc.jar WordCount /home/hduser/gutenberg /home/hduser/gutenberg-output/sample.txt
    

    please change it to :

    /usr/local/hadoop$ bin/hadoop jar wc.jar org.myorg.WordCount /home/hduser/gutenberg /home/hduser/gutenberg-output/sample.txt
    

    that should work.

    @Aswin Alagappan : Reason is a jar file cotains your path in it. JVM cannot find your class in the jar file becase it is in the "jar\org\myorg" path. Understand?

提交回复
热议问题