title: Launch a mapreduce job from eclipse
body: <p>I've written a mapreduce program in Java,  which I can submit to a remote cluster running in distributed mode.  Currently, I submit the job using the following steps:</p>
  
  <ol>
  <li>export the mapreuce job as a jar (e.g. <code>myMRjob.jar</code>)</li>
  <li>submit the job to the remote cluster using the following shell command: <code>hadoop jar myMRjob.jar</code></li>
  </ol>
  
  <p>I would like to submit the job directly from Eclipse when I try to run the program. How can I do this?</p>
  
  <p>I am currently using CDH3, and an abridged version of my conf is:</p>
  
  <pre class="lang-java prettyprint-override"><code>conf.set("hbase.zookeeper.quorum", getZookeeperServers());
  conf.set("fs.default.name","hdfs://namenode/");
  conf.set("mapred.job.tracker", "jobtracker:jtPort");
  Job job = new Job(conf, "COUNT ROWS");
  job.setJarByClass(CountRows.class);
  
  // Set up Mapper
  TableMapReduceUtil.initTableMapperJob(inputTable, scan, 
      CountRows.MyMapper.class, ImmutableBytesWritable.class,  
      ImmutableBytesWritable.class, job);  
  
  // Set up Reducer
  job.setReducerClass(CountRows.MyReducer.class);
  job.setNumReduceTasks(16);
  
  // Setup Overall Output
  job.setOutputFormatClass(MultiTableOutputFormat.class);
  
  job.submit();
  </code></pre>
  
  <p>When I run this directly from Eclipse, the job is launched but Hadoop cannot find the mappers/reducers.  I get the following errors:</p>
  
  <pre><code>12/06/27 23:23:29 INFO mapred.JobClient:  map 0% reduce 0%  
  12/06/27 23:23:37 INFO mapred.JobClient: Task Id :   attempt_201206152147_0645_m_000000_0, Status : FAILED  
  java.lang.RuntimeException: java.lang.ClassNotFoundException:   com.mypkg.mapreduce.CountRows$MyMapper  
      at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:996)  
      at org.apache.hadoop.mapreduce.JobContext.getMapperClass(JobContext.java:212)  
      at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:602)  
      at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)   
      at org.apache.hadoop.mapred.Child$4.run(Child.java:270)  
      at java.security.AccessController.doPrivileged(Native Method)  
      at javax.security.auth.Subject.doAs(Subject.java:396)  
      at   org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1127)  
      at org.apache.hadoop.mapred.Child.main(Child.java:264)  
  ...
  </code></pre>
  
  <p>Does anyone know how to get past these errors? If I can fix this, I can integrate more MR jobs into my scripts which would be awesome!</p>