Win7+Eclipse+Hadoop 运行WordCount报错:java.lang.OutOfMemoryError: Java heap space

在Win7下配置好hadoop集成eclipse开发环境后,运行WordCount程序的时候,有可能会报内存溢出异常:
java.lang.OutOfMemoryError: Java heap space
 at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.<init>(MapTask.java:781)
 at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:350)
 at org.apache.hadoop.mapred.MapTask.run(MapTask.java:307)
 at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:177)
11/08/16 10:31:39 INFO mapred.JobClient:  map 0% reduce 0%
11/08/16 10:31:39 INFO mapred.JobClient: Job complete: job_local_0001
11/08/16 10:31:39 INFO mapred.JobClient: Counters: 0
Exception in thread "main" java.io.IOException: Job failed!
 at org.apache.hadoop.mapred.JobClient.runJob(JobClient.java:1252)
 at mapred.WordCount.main(WordCount.java:110)

原因是客户端程序运行时java虚拟机内存分配不够,修改run configuration(run as >run configurations),选择Arguments选项卡,在VM arguments栏中加入-Xmx1024m,保存后执行没有问题(即将执行时虚拟机内存调大)

你可能感兴趣的:(eclipse,hadoop)