title: Multiple ways to write driver of Hadoop program - Which one to choose?
body: <p>I have observed that there are multiple ways to write driver method of Hadoop program.</p>
  
  <p>Following method is given in <a href="http://developer.yahoo.com/hadoop/tutorial/module4.html" rel="nofollow">Hadoop Tutorial by Yahoo</a></p>
  
  <pre><code> public void run(String inputPath, String outputPath) throws Exception {
      JobConf conf = new JobConf(WordCount.class);
      conf.setJobName("wordcount");
  
      // the keys are words (strings)
      conf.setOutputKeyClass(Text.class);
      // the values are counts (ints)
      conf.setOutputValueClass(IntWritable.class);
  
      conf.setMapperClass(MapClass.class);
      conf.setReducerClass(Reduce.class);
  
      FileInputFormat.addInputPath(conf, new Path(inputPath));
      FileOutputFormat.setOutputPath(conf, new Path(outputPath));
  
      JobClient.runJob(conf);
    }
  </code></pre>
  
  <p>and this method is given in <code>Hadoop The Definitive Guide 2012</code> book by Oreilly.</p>
  
  <pre><code>public static void main(String[] args) throws Exception {
    if (args.length != 2) {
      System.err.println("Usage: MaxTemperature &lt;input path&gt; &lt;output path&gt;");
      System.exit(-1);
    }
    Job job = new Job();
    job.setJarByClass(MaxTemperature.class);
    job.setJobName("Max temperature");
    FileInputFormat.addInputPath(job, new Path(args[0]));
    FileOutputFormat.setOutputPath(job, new Path(args[1]));
    job.setMapperClass(MaxTemperatureMapper.class);
    job.setReducerClass(MaxTemperatureReducer.class);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(IntWritable.class);
    System.exit(job.waitForCompletion(true) ? 0 : 1);
  }
  </code></pre>
  
  <p>While trying program given in Oreilly book I found that constructors of <code>Job</code> class are deprecated. As Oreilly book is based on Hadoop 2 (yarn) I was surprised to see that they have used deprecated class.</p>
  
  <p>I would like to know which method everyone uses?</p>