Testing our application is a relatively simple task.
Let's start with compiling the code. All the following commands should be run from inside the following directory:
/home/pi/hadoop/apps
Inside of this apps
folder create a new directory called wordcount_classes
; this will be where we store our outputted JAR file. You can use the following mkdir
command:
mkdir wordcount_classes
The tool we use for compiling Java code is javac
. This handy command-line utility will take a number of inputs and compile our Java code, outputting an application we can run.
The javac
command takes several flags and parameters. The first flag is –classpath
. This flag points to the Hadoop core JAR file. This is required at the compilation time in order to generate our application. Following this we include the –d
flag. The –d
flag sets the destination directory for our class file.
Finally we reference the Java file we wish to compile, in this case WordCount.java
, as follows:
javac -classpath /home...