原文来自 http://blog.csdn.net/yutianzuijin/article/details/9457431
上文针对hadoop-1.1.2用命令行运行了wordcount, 本文在hadoop-2.7.1平台下运行了《hadoop权威指南:第三版》中的URLCat实例(3.5.1节)
1. hadoop-2.7.1伪分布模式安装请看 点击打开链接
2. 利用eclipse或inteliij编写并编译URLCat.java文件,生成URLCat.class
3. 此时直接运行将会出现“错误: 找不到或无法加载主类 URLCat”,需要将class文件打包成jar:
$ jar cvf URLCat.jar URLCat.class4. 运行:
$bin/hadoop jar URLCat.jar URLCat hdfs://localhost/user/shentao/quangle.txt
On the top of the Crumpetty Tree
The Quangle Wangle sat,
But his face you could not see,
On account of his Beaver Hat.