自己写的MapReduce程序运行问题
2014-08-11 14:49
155 查看
Exception
in thread "main" java.lang.ClassNotFoundException: WordCount
出现这个问题主要是调用的问题,没有加入包
bin/hadoop jar wordcount.jar WordCount wc_input wc_output
改成如下的样子就可以了
bin/hadoop jar wordcount.jar com.hadoop.WordCount wc_input wc_output
整个过程的commander如下,仅供参考,环境是Hadoop集群XShell:
rz // -- 上传WordCount.java 和file*.txt (rm, mv, rm -rf 删除目录)
全部操作都在对应版本的Hadoop文件夹中!例如我是在hadoop-1.0.4下(囧,集群最高版本就是这个了...)
bin/hadoop fs -mkdir input // -- 新建input文件夹,并将file*.txt mv进去
bin/hadoop fs -put input/file* wc_input // --将本地输入文件上传hdfs集群
mkdir WordCount // --创建WordCount目录
javac -classpath hadoop-core-1.0.4.jar:lib/commons-cli-1.2.jar -d WordCount WordCount.java
// --编译WordCount.java,结果放入WordCount目录
jar -cvf wordcount.jar -C WordCount .
// --将编译结果打成jar包 !!注意在WordCount后面有空格,然后还有一个"."!!
bin/hadoop jar wordcount.jar com.hadoop.WordCount wc_input wc_output
// --在集群上运行,注意加入调用的包
bin/hadoop fs -cat wc_output/part-r-00000 // --查看输出结果
in thread "main" java.lang.ClassNotFoundException: WordCount
出现这个问题主要是调用的问题,没有加入包
bin/hadoop jar wordcount.jar WordCount wc_input wc_output
改成如下的样子就可以了
bin/hadoop jar wordcount.jar com.hadoop.WordCount wc_input wc_output
整个过程的commander如下,仅供参考,环境是Hadoop集群XShell:
rz // -- 上传WordCount.java 和file*.txt (rm, mv, rm -rf 删除目录)
全部操作都在对应版本的Hadoop文件夹中!例如我是在hadoop-1.0.4下(囧,集群最高版本就是这个了...)
bin/hadoop fs -mkdir input // -- 新建input文件夹,并将file*.txt mv进去
bin/hadoop fs -put input/file* wc_input // --将本地输入文件上传hdfs集群
mkdir WordCount // --创建WordCount目录
javac -classpath hadoop-core-1.0.4.jar:lib/commons-cli-1.2.jar -d WordCount WordCount.java
// --编译WordCount.java,结果放入WordCount目录
jar -cvf wordcount.jar -C WordCount .
// --将编译结果打成jar包 !!注意在WordCount后面有空格,然后还有一个"."!!
bin/hadoop jar wordcount.jar com.hadoop.WordCount wc_input wc_output
// --在集群上运行,注意加入调用的包
bin/hadoop fs -cat wc_output/part-r-00000 // --查看输出结果
相关文章推荐
- 单机伪分布式模式 运行MapReduce程序 配置问题
- 使用命令行编译打包运行自己的MapReduce程序 Hadoop2.4.1
- 使用命令行编译打包运行自己的MapReduce程序 Hadoop2.6.0
- 使用命令行编译打包运行自己的MapReduce程序 hadoop2.7.3
- 在eclipse上运行MapReduce的wordcount程序所遇到的问题
- gcc编译静态库到自己的程序 解决在不同linux下因libc版本问题而不能运行
- Linux巩固记录(5) hadoop 2.7.4下自己编译代码并运行MapReduce程序
- OPENCV运行的问题,自带的程序可以运行,但是自己制作的QT报错
- Spark1.0.1sbt打包运行自己程序及问题解决
- MapReduce程序运行中的排序问题
- Eclipse中运行MapReduce程序时控制台无法打印进度信息的问题
- 在eclipse中运行mapreduce程序全过程,问题详解
- 简单的java扫雷程序,已运行成功。自己想出来的,有个问题很困惑有望高手能解答。
- Window7中Eclipse运行MapReduce程序报错的问题
- 打包运行自己的MapReduce程序
- 在eclipse中运行mapreduce程序全过程,问题详解
- 使用命令行编译打包运行自己的MapReduce程序 Hadoop2.4.1
- 在 Eclipse 中运行 MapReduce 程序会遇到的问题
- Hadoop学习笔记2:eclipse运行Mapreduce程序问题总结
- Windows下使用eclipse插件运行自己的MapReduce程序