Friday, 25 October 2013

Compiling and running a Hadoop java program

create classes from .java code file

javac -classpath hadoop-core-1.2.1.jar:lib/commons-cli-1.2.jar -d code/classes code/WordCount.java

create .jar from classes 

jar -cvf code/wordcount.jar -C code/classes/ .

run the program

hadoop jar code/wordcount.jar org.apache.hadoop.examples.WordCount inputdir outputdir

view the results

hadoop fs -cat output/*

No comments:

Post a Comment