Time for action – setting up the classpath
To compile any Hadoop-related code, we will need to refer to the standard Hadoop-bundled classes.
Add the Hadoop-1.0.4.core.jar
file from the distribution to the Java classpath as follows:
$ export CLASSPATH=.:${HADOOP_HOME}/Hadoop-1.0.4.core.jar:${CLASSPATH}
What just happened?
This adds the
Hadoop-1.0.4.core.jar
file explicitly to the classpath alongside the current directory and the previous contents of the CLASSPATH environment variable.
Once again, it would be good to put this in your shell startup file or a standalone file to be sourced.
Note
We will later need to also have many of the supplied third-party libraries that come with Hadoop on our classpath, and there is a shortcut to do this. For now, the explicit addition of the core JAR file will suffice.