1.设置hadoop-env.sh的export HADOOP_CLASSPATH=/home/grid/hadoop-1.2.1/myclass
2.设置JAVA_HOME和ClassPath
export PATH=:/home/grid/jdk1.6.0_30/bin
export JAVA_HOME=/home/grid/jdk1.6.0_30
3.用javac命令编译javac -classpath ../hadoop-core-1.2.1.jar FileSystemCat.java
4.向Hadoop复制文件bin/hadoop fs -put build.xml ./in
5.查看复制的文件:bin/hadoop fs -ls .
6. 运行编译好的文件:../bin/hadoop FileSystemCat hdfs://master:9000/user/grid/in/build.xml
7.编译结果:
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/19447.html