Java – Compiling Hadoop 2.2.0 jobs?

Compiling Hadoop 2.2.0 jobs?… here is a solution to the problem.

Compiling Hadoop 2.2.0 jobs?

It seems that all the examples were built with older versions in mind.

How do I compile my java program on Ubuntu so that it references the hadoop-2.2.0 library?

Where are the jar files I should include?

What is the command?
Is it –

javac -classpath libraries wordcount.java

Thank you.

Solution

The simplest solution for Linux machines is:

javac -classpath `yarn classpath` -d . WordCount.java

Or:

export CLASSPATH=`yarn classpath`
javac -classpath $CLASSPATH -d . WordCount.java

Related Problems and Solutions