把hadoop-eclipse-plugin-2.2.0.jar放到Eclipse的plugin目录,重启Eclipse后,运行WordCount报错:
Java代码如下:
package com.lyq.study.example;
import java.io.IOException;
import java.util.StringTokenizer;
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.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.GenericOptionsParser;
public class WordCount {
public static class TokenizerMapper
extends Mapper<Object, Text, Text, IntWritable>{
private final static IntWritable one = new IntWritable(1);
private Text word = new Text();
public void map(Object key, Text value, Context context
) throws IOException, InterruptedException {
StringTokenizer itr = new StringTokenizer(value.toString());
while (itr.hasMoreTokens()) {
word.set(itr.nextToken());
context.write(word, one);
}
}
}
public static class IntSumReducer
extends Reducer<Text,IntWritable,Text,IntWritable> {
private IntWritable result = new IntWritable();
public void reduce(Text key, Iterable<IntWritable> values,
Context context
) throws IOException, InterruptedException {
int sum = 0;
for (IntWritable val : values) {
sum += val.get();
}
result.set(sum);
context.write(key, result);
}
}
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
conf.set("fs.defaultFS", "hdfs://master129:9000/");
conf.set("mapreduce.framework.name", "local");
conf.set("mapred.job.tracker", "master129:9001");
conf.set("hbase.zookeeper.quorum", "master129,slave130,slave131,slave132");
args = new String[]{"hdfs://master129:9000/test/input/","hdfs://master129:9000/test/output"};
String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
if (otherArgs.length != 2) {
System.err.println("Usage: wordcount <in> <out>");
System.exit(2);
}
Job job = new Job(conf, "word count");
job.setJarByClass(WordCount.class);
job.setMapperClass(TokenizerMapper.class);
job.setCombinerClass(IntSumReducer.class);
job.setReducerClass(IntSumReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
FileInputFormat.addInputPath(job, new Path(otherArgs[0]));
FileOutputFormat.setOutputPath(job, new Path(otherArgs[1]));
System.exit(job.waitForCompletion(true) ? 0 : 1);
}
}
控制台报错如下:
Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\app\hadoop-2.2.0\bin\hadoop.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1732)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at com.lyq.study.example.A.main(A.java:5)
解决方法:
把笔记本上安装的32位jdk,改成64位的。
相关推荐
hadoop eclipse plugin for version 1.0.1
hadoop-eclipse-plugin-3.1.1, hadoop eclipse 插件 3.1.1
hadoop eclipse plugin,可以集成Eclipse进行开发。
hadoop-eclipse-plugin-1.2.1hadoop-eclipse-plugin-1.2.1hadoop-eclipse-plugin-1.2.1hadoop-eclipse-plugin-1.2.1
Hadoop Eclipse是Hadoop开发环境的插件,用户在创建Hadoop程序时,Eclipse插件会自动导入Hadoop编程接口的jar文件,这样用户就可以在Eclipse插件的图形界面中进行编码、调试和运行Hadop程序,也能通过Eclipse插件...
hadoop官方自带的eclipse插件貌似不能使用 在连接hadoop集群的时候报错 我根据这篇文章对jar包进行了修改 http://hi.baidu.com/wangyucao1989/blog/item/279cef87c4b37c34c75cc315.html 亲测正常使用
Eclipse集成Hadoop2.10.0的插件,使用`ant`对hadoop的jar包进行打包并适应Eclipse加载,所以参数里有hadoop和eclipse的目录. 必须注意对于不同的hadoop版本,` HADDOP_INSTALL_PATH/share/hadoop/common/lib`下的jar包...
用来配置myeclipse或eclipse对应的hadoop 插件,方便开发
hadoop-eclipse-plugin-3.1.3,eclipse版本为eclipse-jee-2020-03
hadoop-eclipse-plugin-2.7.4.jar和hadoop-eclipse-plugin-2.7.3.jar还有hadoop-eclipse-plugin-2.6.0.jar的插件都在这打包了,都可以用。
hadoop-eclipse-plugin-2.7.2.jar完美兼容版 Tested with following eclipse version for hadoop2.7.2(http://pan.baidu.com/s/1i4plIfF): Eclipse Java EE IDE for Web Developers. Version: Mars.1 Release (4.5.1...
hadoop-eclipse-plugin.jar插件基于Ubuntu18.04和Hadoop-3.2.1编译的,最后可以在eclipse创建Map Reduce文件
该文档是hadoop-eclipse-plugin-2.7.6的下载地址及提取码
网上没找到2.8.1的版本,自己编译,经测试可用。
hadoop-eclipse-plugin-2.7.3和2.7.7的jar包 hadoop-eclipse-plugin-2.7.3和2.7.7的jar包 hadoop-eclipse-plugin-2.7.3和2.7.7的jar包 hadoop-eclipse-plugin-2.7.3和2.7.7的jar包
hadoop1.0.0没有提供eclipse插件的jar包,但是提供了源码,编译后,供大家下载。
最新的hadoop-eclipse-plugin-2.7.4.jar 很好用的hadoop的eclipse插件。自己编译的。 经过测试,使用没有任何问题。 请各位放心使用
eclipse中需要的hadoop插件,对应hadoop版本3.x。 注意:插件的版本要和用的hadoop版本保持一致
eclipse连接hadoop搭建mapreduce开发环境。本资源含有hadoop-2.8.5.tar和在eclipse配置mapreduce环境的plugin的jar包,版本为2.8.5
找不到与hadoop-2.9.2版本对应的插件,手动生成的hadoop-eclipse-plugin-2.9.2版本,