Reputation: 4728
First, I KNOW THIS HAS BEEN ASKED BEFORE, but none of the solutions work for me and I would like to know why.
I am trying to compile the standard 'WordCount.java' .jar for hadoop on my linux single-node cluster, but keep getting the package org.apache.hadoop.* does not exist
error.
I know that I have to edit the $CLASSPATH, but everything I have found online is saying to reference hadoop-core
and I cannot find a hadoop-core
anywhere in my build (2.4.0). How do I find where org.apache.hadoop.* would exist on my system?
I feel this would be a good 'general' answer since I have seen many questions on this and everyone gives a specific /path/to/classpath/, but it is (apparently) different depending on version and build of hadoop.
Upvotes: 8
Views: 15881
Reputation: 2262
As you said, the CLASSPATH you need depends on version, location, and type of installation. How to install it is a separate discussion, but assuming you have a proper hadoop setup installed, it's easy (though I admit, I have no clue where it is documented).
Hadoop provides a convenient utility to get the CLASSPATH information you need. Run this
bin/hadoop classpath
This should give you the information you need set your classpath for compiling your code.
Upvotes: 20