1.编译打包
#创建一个放 class 文件的目录
$ mkdir class
#编译 WordCount 源文件
javac -classpath/opt/hadoop-2.2.0/share/hadoop/common/hadoop-common-2.2.0.jar:/opt/hadoop-2.2.0/share/hadoop/mapreduce/hadoop-mapreduce-client-core-2.2.0.jar-d class WordCount.java
#将程序打包;
###"."前有空格
$ jar -cvfwordcount.jar -C class .
2.运行
准备数据
hadoop fs –mkdir /in
hadoop fs -put 1.txt /in
运行
hadoop jar /home/hadoop/wordcount.jar org.apache.hadoop.examples.WordCount /in /out
又运行一次
hadoop jar /home/hadoop/wordcount.jar org.apache.hadoop.examples.WordCount /in/out1
查看:localhost:8088
点击:History,跳转到localhost:19888