Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ClassNotFoundException: Class WordCount$TokenizerMapper not found

 
Akhilesh Trivedi
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying this example

and getting following error



What can be the problem?
 
Paul Clapham
Sheriff
Posts: 21546
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you copied the compiled WordCount class from wherever it came from, you failed to also copy the compiled version of that inner class.
 
Akhilesh Trivedi
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the jar... I did a jar of *.class and all my class files were there. I have even checked decompiling the jar, it has the WordCount java with the inner class being inside it.
 
Paul Clapham
Sheriff
Posts: 21546
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Evidently WordCount.class is in your classpath but WordCount$TokenizerMapper.class isn't. So if WordCount$TokenizerMapper.class is in that jar (which I think you sort of said it was) then that jar isn't in your classpath.
 
Akhilesh Trivedi
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All the classes and jar are at same location.
 
Paul Clapham
Sheriff
Posts: 21546
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same location? So what? If you can't load the class, that's almost certainly because it isn't in your classpath. And if your classpath isn't right, it doesn't matter where you put things.
 
Akhilesh Trivedi
Ranch Hand
Posts: 1608
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it working... added the directory to classpath, logged in as root and ran the command from the directory one step up.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic