Java 如何在Eclipse中运行MapReduce程序
我在服务器上有一个hadoop环境,现在我在本地PC上开发,我在Eclipse中编写了一个MapReduce类(仅覆盖Mapper类),并在一个main方法中设置了相应的配置,现在我想在Eclipse中运行我的程序,但我在“Debug As:Junit Test”过程中遇到了一个问题,错误信息如下:Java 如何在Eclipse中运行MapReduce程序,java,eclipse,hadoop,launch,mapper,Java,Eclipse,Hadoop,Launch,Mapper,我在服务器上有一个hadoop环境,现在我在本地PC上开发,我在Eclipse中编写了一个MapReduce类(仅覆盖Mapper类),并在一个main方法中设置了相应的配置,现在我想在Eclipse中运行我的程序,但我在“Debug As:Junit Test”过程中遇到了一个问题,错误信息如下: java.lang.Exception:方法main不应具有任何参数 Java虚拟机启动器 找不到主类:TestMapReducedCodeAndCompressSelfSetting.cla
java.lang.Exception:方法main不应具有任何参数
Java虚拟机启动器
找不到主类:TestMapReducedCodeAndCompressSelfSetting.class。程序将退出。要在windows机器上运行eclipse中的Map Reduce,您需要下载hadoop-7682 java文件。在conf文件中引用此文件,如下所示 config.set(“fs.file.impl”、“com.assignment.WinLocalFileSystem”) 这里,WinLocalFileSystem是java类 附上示例代码供您参考
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));