首页 \ 问答 \ 在LINUX 搭建eclipse+hadoop 编译代码出现错误

在LINUX 搭建eclipse+hadoop 编译代码出现错误

package org.apache.hadoop.examples;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
         
          {        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
          
            {    private IntWritable result = new IntWritable();    public void reduce(Text key, Iterable
           
             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();    String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();    if (otherArgs.length != 2) {      System.err.println("Usage: wordcount 
             
             
              ");      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);  }}
              hadoop : hadoop-1.2.1 (因为eclipse插件不符合,特意换了以前版本的)
              eclipse : eclipse-jee-SR1-indigo-gtl.tar.gz
              JDK : jdk 1.8
              
              一种错误是图片上的 
              还有一个 显示  :  Multiple markers at this line    - The type java.util.Map$Entry cannot be resolved. It is indirectly referenced      from required .class files    - The type java.util.Map$Entry cannot be resolved. It is indirectly referenced      from required .class files
更新时间:2024-02-09 08:02

最新回答

Redis安装与启动1.下载RedisRedis本身没有提供Windows版本的,并且在Windows上也不太稳定,一般都将其部署到Linux环境下,Redis可以在其官网上下载,MSOpenTech中提供了Windows版本,这里为了学习安装这一版本。点击跳转到Github后,直接点击Zip下载。下载后根据自己计算机的版本选择32位或者64位进行安装。我将64位的解压后放到D:\Redis文件夹下,同时将文件夹内的redis.conf也拷贝到该目录下,这个是redis的配置信息:2.启动Redis在Windows下面启用Redis和启动MogoDB一样,需要使用命令行启动,首先定位到该目录,运行如下命令:D:\Redis>redis-server.exeredis.conf因为是在本机运行的,这里要注意端口号,同时要保持端口不要关闭。当然您也可以将Redis作为Windows服务在后台一直开启。3.使用现在再开一个控制台应用程序连接之前启动的Redis,如下:D:\Redis>redis-cli.exe-h172.16.147.121-p6379其中–h后面是本机的ip地址,后面的是端口。然后就可以执行set给key为city赋值:redis172.16.147.121:6379>setcityShanghai通过get可以获取指定key为city的值了。redis172.16.147.121:6379>getcity同时,在我们往redis上写数据的时候,Redis服务也会定时的往文件中写数据这里仅简单的介绍了get和set命令,命令可以查看mands.初探Redis下载ServiceStack.Redis和MongoDB一样,在.NET中使用Redis其实也是使用第三方驱动,官网推荐的是使用ServiceStack.Redis下载后解压得到如下dll.NET项目中使用Redis新建一个Console程序,引用上一步骤解压的四个dll。做一个简单的例子,在.NET中获取之前我们设置的city的值。classProgram{staticRedisClientredisClient=newRedisClient("172.16.147.121",6379);//redis服务IP和端口staticvoidMain(string[]args){Console.WriteLine(redisClient.Get("city"));Console.ReadKey();}}首先通过staticRedisClientredisClient=newRedisClient("172.16.147.121",6379);建立连接,然后就可以直接用redisClient里面的Get方法获取key为city的值了。在前面的命令行中,我们网city中存入了Shanghai,现在我们获取到了这个值。ServerStack中有很多方法可以在.NET中调用,其类结构图如下:总结本文简单介绍了Redis,Redis如何在Windows下安装,以及如何在.NET中使用访问和使用Redis,希望对您有所帮助,下文将讲解如何在.NET中网Redis中读写复杂对象。

相关问答

更多
  • public class RedisListJava { public static void main(String[] args) { //连接本地的 Redis 服务 Jedis jedis = new Jedis("localhost"); System.out.println("Connection to server sucessfully"); //存储数据到列表中 jedis.lpush("tutorial-list", "Redis"); jedis.lpush("tutorial-lis ...
  • 1. Redis使用场景 Redis是一个开源的使用ANSI C语言编写、支持网络、可基于内存亦可持久化的日志型、Key-Value数据库,并提供多种语言的API。 我们都知道,在日常的应用中,数据库瓶颈是最容易出现的。数据量太大和频繁的查询,由于磁盘IO性能的局限性,导致项目的性能越来越低。 这时候,基于内存的缓存框架,就能解决我们很多问题。例如Memcache,Redis等。将一些频繁使用的数据放入缓存读取,大大降低了数据库的负担。提升了系统的性能。 其实,对于hibernate的二级缓存,是同样的道理 ...
  • 增加了Redis HyperLogLog命令PFADD,PFCOUNT,PFMERGE 可以使用Jackson基于RedisSerializer对Java类型序列化 使用PropertySource配置Redis Sentinel连接,目前仅Jedis客户端支持!
  • 搭好redis服务器后,可以使用StackExchange.Redis组件访问redis服务。这套组件是StackExchange组织写的,api强大且完整,完全免费。
  • 搭好redis服务器后,可以使用StackExchange.Redis组件访问redis服务。这套组件是StackExchange组织写的,api强大且完整,完全免费。
  • 比较流行的也是官方推荐的 .Net 访问 Redis 的中间件 ServiceStack StackExchange ServiceStack.Redis 4.* 的版本,开始有条件收费,好像是达到一定请求量就会收费 还好 4.* 以前的是免费的 StackExchange 是免费,但是,最近听说要收费,待验证 区别 收费和免费的区别。收费就会享受收费的服务,免费,人家就没有那个义务 ServiceStack 存取数据,可以直接进行序列化和反序列化。StackExchang 需要自己处理序列化和反序列化 S ...
  • public class RedisListJava { public static void main(String[] args) { //连接本地的 Redis 服务 Jedis jedis = new Jedis("localhost"); System.out.println("Connection to server sucessfully"); //存储数据到列表中 jedis.lpush("tutorial-list", "Redis"); jedis.lpush("tutorial-lis ...
  • 增加了Redis HyperLogLog命令PFADD,PFCOUNT,PFMERGE 可以使用Jackson基于RedisSerializer对Java类型序列化 使用PropertySource配置Redis Sentinel连接,目前仅Jedis客户端支持!
  • 您需要使用scan而不是hscan。 结合SCAN和HGETALL,您可以实现这一目标。 1)执行扫描并获取与您的模式匹配的所有值 127.0.0.1:6379> scan 0 match rules:1231231234* 1) "0" 2) 1) "rules:1231231234_11:00_17:00" 2) "rules:1231231234_9:00_10:59" 2)然后,对于app逻辑中的每个键,迭代它们并执行hgetall 127.0.0.1:6379> hgetall rules ...
  • 这取决于具有spring-data-jpa的应用程序使用的JPA实现库。 我将谈论两个流行的JPA实现:Hibernate和Eclipselink。 Eclipselink只能使用自己的二级缓存提供程序,因此无法将Redis用作二级缓存。 Hibernate提供了将第三方缓存库用作二级缓存提供程序的功能。 最新的Hibernate 5.1内置支持两个缓存库:Ehcache和Infinispan: Hibernate文档 。 有专有和开源库支持其他缓存提供程序,包括Redis: GitHub:debop / ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)