How to jar a Java program for Hadoop
I am going through Chapter 2 of Hadoop: The Definitive Guide 4e.
The book tells me to do the following steps:
export HADOOP_CLASSPATH=hadoop-examples.jar hadoop MaxTemperature input/ncdc/sample.txt output
What is hadoop-examples.jar? How do I jar MaxTemperature?
The code is available here: https://github.com/tomwhite/hadoop-book/tree/master/ch02-mr-intro/src/main/java
In border of my school studies we did nearly the same.
You just have to compile it directly into a jar file. So you can use it easier from command line or hadoop. Otherwise you would need to compile it with
javac filename1.java filename2.java
and go on, also with all the libraries.
I guess you use something like Eclipse as IDE. There you can compile it directly into a jar file.
Export > Java > Runnable JAR file
Then you can use it in command line like this:
java -jar filename.jar
or put it into the hadoop cluster.