Windows下基于Eclipse的Hadoop开发环境完全配置(三)

来源:互联网 发布:华为网络机顶盒官网 编辑:程序博客网 时间:2024/06/08 12:11

启动Eclipse,

  • 右键点击  Project Explorer 窗口,选择 New -> Project.. 找到 Map/Reduce Project,Next,输入名字。
  • 点击下面的Config Hadoop Install Directiory,输入Hadoop的目录,如:C:/cygwin/home/User/hadoop-0.19.2
  • 右键点击新创建的 Hadoop 工程,选择  New -> Other 转到 Map/Reduce 文件夹, 选择 MapReduceDriver 然后点击 Next,输入名字,点击Finish。
  • 新创建了一个文件,但是有错误,把
  • conf.setInputPath(new Path("src"));
    conf.setOutputPath(new Path("out"));

    换为

    conf.setInputFormat(TextInputFormat.class);
    conf.setOutputFormat(TextOutputFormat.class);

    FileInputFormat.setInputPaths(conf, new Path("In"));
    FileOutputFormat.setOutputPath(conf, new Path("Out"));
    右键点击文件,选择 Run As --> Run on Hadoop. 弹出以下窗口:

     选择 "Choose existing hadoop location" , 然后选择刚才创建的localhost ,点Finish 就开始运行了.

    结束了^_^

    原创粉丝点击