Exception in thread “main“ java.lang.RuntimeException: Error while running command to get file permi

注意!!!这是在eclipse里面运行的Hadoopapi
问题描述:

Exception in thread "main" java.lang.RuntimeException: Error while running command to get file permissions : java.io.IOException: (null) entry in command string: null ls -F D:*******

具体代码如下(不包括map和reduce部分):

package com.gao;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;


public class WordCount {

	public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
		//1.获取job实例
		Configuration con=new Configuration();
		Job job=Job.getInstance(con,"WordCount");
		//2.设置jar包
		job.setJarByClass(WordCount.class);
		//3.设置mapper和reducer
		job.setMapperClass(MyMapper.class);
		job.setReducerClass(MyReduce.class);
		//4.设置map和reduce的输出类型
		job.setMapOutputKeyClass(IntWritable.class);
		job.setMapOutputValueClass(Text.class);
		
		job.setOutputKeyClass(Text.class);
		job.setOutputValueClass(IntWritable.class);
		
		//5.设置输入输出文件
		FileInputFormat.setInputPaths(job, new Path("D:\\gao\\input\\"));
		FileOutputFormat.setOutputPath(job,new Path("D:\\gao\\output"));
		
		//6.提交job
		System.exit(job.waitForCompletion(true)?0:1);
		
		// TODO Auto-generated method stub
		
		
		
		
	
		
	}

}

问题思考:是无法这个文件权限的问题,所以就以这个思路去解决–》搜索后有博客说是system32下缺少Hadoop.dll文件和winutils文件–》问题任然没有得到解决-----》最后我把这个文件的全路径写进去之后,最后问题解决!!!

//5.设置输入输出文件
		FileInputFormat.setInputPaths(job, new Path("D:\\gao\\input\\data.txt"));
		FileOutputFormat.setOutputPath(job,new Path("D:\\gao\\output"));

你可能感兴趣的:(Hadoop,hadoop,mapreduce,eclipse)