FileInputFormat.addInputPath(job, new Path(otherArgs[0]));
FileOutputFormat.setOutputPath(job, new Path(otherArgs[1]));
新老包导错了会编译不过去...
然后运行.在Main方法类里右键,Run As -> Run Configurations -> Arguments
配置一下运行参数,主要有2个. 一个是 hdfs的 输入, 一个是输出.(输出文件夹必须是不存在的)
我的是: hdfs://centos1:9000//user/hadoop/input hdfs://centos1:9000//user/hadoop/output
可能出现的异常:
1.
Hadoop Failed to set permissions of path
这个是Windows下文件权限问题,在Linux下可以正常运行,不存在这样的问题。
解决方法是,修改/hadoop-xxx/src/core/org/apache/hadoop/fs/FileUtil.java里面的checkReturnValue,注释掉生成class文件替换安装目录下的 hadoop-core-x.xx.xxx.x.jar
If "true", enable permission checking in HDFS.
If "false", permission checking is turned off,
but all other behavior is unchanged.
Switching from one parameter value to the other does not change the mode,
owner or group of files or directories.