hadoop在eclipse当中如何添加源码?
[学习笔记]
/*org.apache.hadoop.mapreduce.Mapper.Context,java.lang.InterruptedException,想看map的源代码,按control,点击,出现Attach Source Code,点击External Location/External File,找到源代码,就在Source目录下,,D:\hadoop-2.7.4\src
其中key为此行的开头相对于文件的起始位置,value就是此行的字符文本
*/ public void map(Object key, Text value, Context context) throws IOException, InterruptedException {
System.out.println("key is 马克-to-win @ 马克java社区 "+key.toString()+" value is "+value.toString());
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 {
System.out.println("reduce key is 马克-to-win @ 马克java社区 "+key.toString());
int sum = 0;
for (IntWritable val : values) {
int valValue=val.get();
System.out.println("valValue is"+valValue);
sum += valValue ;
}
result.set(sum);
context.write(key, result);
}
}
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
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);
文章转载自原文:https://blog.csdn.net/qq_44594249/article/details/96110661
hadoop在eclipse当中如何添加源码?的更多相关文章
- eclipse手动添加源码
在开发过程中,有的时候需要我们自已手动去添加一些源码文件,但是由于我们可能在eclipse中安装了jad反编译插件,我们再用“Ctrl + 鼠标左键”的话,会打开已经反编译好的class文件,而不是带 ...
- eclipse添加源码的另外一种方法
当我们使用maven或者gradle时,我们不需要担心源码的问题.Maven会帮我们下载jar包的同时下载对应的源码包.一般为source.jar,比如servlet-api-2.5-sources. ...
- Android 添加源码到eclipse 以及相关设置
作者:舍得333 主页:http://blog.sina.com.cn/u/1509658847版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出版.作者信息和本声明,否则将追究法律 ...
- vs2015 去除 git 源代码 绑定,改成向tfs添加源码管理
除了下文的方法是将源码管理从git改成tfs之外,还要做以下几步即可 向tfs添加源码 打开源码管理(管理连接),双击打开你要向其中添加的tfs连接 选中该解决方案,右键 将解决方案添加到源码管理 嵌 ...
- Eclipse或MyEclipse中给第三方jar包添加源码步骤
0.目的 向web项目中添加mybatis源码. 1.项目结构如下 将mybatis的jar包添加到工程中 2.解压下载的mybatis压缩包(下载地址 https://github.com/myba ...
- Java中eclipse中添加源码依赖
Window ->Preferences ->Java->instanlled jres ->editrt.jarsource attachment一般在jdk的目录下的sr ...
- myeclipse2014如何添加源码反编译工具插件
Eclipse下的Java反编译插件:Eclipse Class Decompiler,整合了目前最好的2个Java反编译工具Jad和JD-Core,并且和Eclipse Class Viewer无缝 ...
- myeclipse添加源码支持
在MyEclipse中开发,习惯于点击类名,按Ctrl键查看源码,但是,如果是Spring/Hibernate/Struts/JDK这些开源jar的源码该如何看呢? 一般,我们导入的只有jar文 件, ...
- selenium添加源码,解决打开源码不显示问题
问题1: 我已经导入了源码包,单在源码中点击get,想查看源码 WebDriver driver=new FirefoxDriver(); driver.get("http://www.ba ...
随机推荐
- ubuntu中防火墙iptables配置
特别说明:此文章完全转载于https://www.cnblogs.com/EasonJim/p/6851007.html 1.查看系统是否安装防火墙 root@localhost:/usr# whic ...
- mac 安装rabbitmq出现的问题
一直提示这个文件权限问题. 然后试了各种办法.chown user:group / chmod 777 等等.都没有解决. 最后查到 chmod 666 /users/xxx/.erlang.cook ...
- 【模板】杜教筛(Sum)
传送门 Description 给定一个正整数\(N(N\le2^{31}-1)\) 求 \[ans1=\sum_{i=1}^n \varphi(i)\] \[ans_2=\sum_{i=1}^n \ ...
- centos7 安装 Mysql 5.7.27,详细完整教程
1. 下载 MySQL yum包 wget http://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm 2.安装MySQL源 ...
- [RK3399] 汇顶gt9xx触摸屏在RK原始代码调试
CPU:RK3399 系统:Android 7.1 触摸屏:1024x768 8inch 触摸IC:GT9271 基于RK3399,从瑞芯微服务器更新到最新的 Android 7.1 代码中,瑞芯 ...
- ML_Review_GMM(Ch10)
Note sth about GMM(Gaussian Mixtrue Model) 高斯混合模型的终极理解 高斯混合模型(GMM)及其EM算法的理解 这两篇博客讲得挺好,同时讲解了如何解决GMM参数 ...
- secureCRT操作redis-cli时, 不断追加ip:port
Session Options-->Terminal-->Emulation-->Terminal为Linux
- 三种Timer使用
System.Windows.Forms.Timer, System.Threading.Timer, System.Timer,三种Timer使用如下 第一种:System.Windows.Fo ...
- 手把手教你MyEclipseUML建模(上)
手把手教你MyEclipseUML建模(上) 转 https://blog.csdn.net/qq_37939251/article/details/83444359 1.用UML 1建模 MyEcl ...
- Github排名靠前的iOS库
//iOS第三方开源库的吐槽和备忘 http://blog.ibireme.com/2013/09/23/ios-third-party-libs/#more-41361 //整理了一份Github上 ...