質問

I have a hadoop environment on server, now I develop on my local PC, I have written a MapReduce Class (overwrite Mapper Class only) in Eclipse, and set the corresponding configuration in a main method, now I want to run my program in Eclipse, but I have a problem during "Debug As: Junit Test", get the error info as follow:


java.lang.Exception: Method main should have no parameters ......


Java Virtual Machine Launcher

Could not find the main class: TestMapReduceDecodeAndCompressSelfSetting.class. Program will exit.

役に立ちましたか?

解決

To run Map Reduce in eclipse on a windows machine you need to download hadoop-7682 java file. Refer this file in the conf file as below.

config.set("fs.file.impl", "com.assignment.WinLocalFileSystem");

Here WinLocalFileSystem is the java class.

Attaching a sample code for your reference.

Configuration config = new Configuration();
    config.set("mapreduce.input.keyvaluelinerecordreader.key.value.separator", " ");
    config.set("mapred.textoutputformat.separator", " --> ");
    config.set("fs.file.impl", "com.assignment.WinLocalFileSystem");

    String inputPath="In\\VISA_Details.csv";
    Path inPath=new Path(inputPath);
    String outputPath = "C:\\Users\\Desktop\\Hadoop Learning\\output\\run1";
    Path outPath=new Path(outputPath);

    Job job = new Job(config,"VISA: Total count on each day");
    job.setInputFormatClass(TextInputFormat.class);
    job.setOutputFormatClass(TextOutputFormat.class);

    job.setMapOutputKeyClass(Text.class);
    job.setMapOutputValueClass(Text.class);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(Text.class);

    job.setMapperClass(VisaMapper.class);
    job.setReducerClass(VisaReducer.class);

    FileInputFormat.setInputPaths(job, inPath );
    FileOutputFormat.setOutputPath(job, outPath);

    System.out.println(job.waitForCompletion(true));
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top