title: How to run a mapreduce job in Hortonworks sandbox Hadoop platform
body: <p>I am new in Hadoop. I have installed the oracle virtual box for and mounted the image of hortonworks sandbox in the virtual machine.also i have written the wordcount program in eclipse and trying to run that in the virtual machine. But I am getting an exception tree. I am posting the program and the error tree also.</p>
  
  <pre><code>public class WordCount {
  
  public static class Map extends MapReduceBase implements
          Mapper&lt;LongWritable, Text, Text, IntWritable&gt; {
      private final static IntWritable one = new IntWritable(1);
      private Text word = new Text();
  
      public void map(LongWritable key, Text value,
              OutputCollector&lt;Text, IntWritable&gt; output, Reporter reporter)
              throws IOException {
          String line = value.toString();
          StringTokenizer tokenizer = new StringTokenizer(line);
          while (tokenizer.hasMoreTokens()) {
              word.set(tokenizer.nextToken());
              output.collect(word, one);
          }
      }
  }
  
  public static class Reduce extends MapReduceBase implements
          Reducer&lt;Text, IntWritable, Text, IntWritable&gt; {
      public void reduce(Text key, Iterator&lt;IntWritable&gt; values,
              OutputCollector&lt;Text, IntWritable&gt; output, Reporter reporter)
              throws IOException {
          int sum = 0;
          while (values.hasNext()) {
              sum += values.next().get();
          }
          output.collect(key, new IntWritable(sum));
      }
  }
  
  public static void main(String[] args) throws IOException {
      JobConf conf = new JobConf(WordCount.class);
      conf.setJobName("wordcount");
  
      conf.setOutputKeyClass(Text.class);
      conf.setOutputValueClass(IntWritable.class);
  
      conf.setMapperClass(Map.class);
      conf.setCombinerClass(Reduce.class);
      conf.setReducerClass(Reduce.class);
  
      conf.setInputFormat(TextInputFormat.class);
      conf.setOutputFormat(TextOutputFormat.class);
  
      FileInputFormat.setInputPaths(conf, new Path(args[0]));
      FileOutputFormat.setOutputPath(conf, new Path(args[1]));
  
      JobClient.runJob(conf);
  
  }
  
  }
  </code></pre>
  
  <p>[hue@sandbox`]$hadoop jar/usr/lib/wordcount.jar wordcount[-m][-r]</p>
  
  <p>Exception in thread main java.lang.NoClassDefFoundError:jar/usr/lib/wordcount/jar</p>
  
  <p>caused by:java.lang.ClassNotFoundException:jar.usr.lib.wordcount.jar
      at java.net.URLClassLoader$1.run(URLlassLoader.java:202)
      at java.security.AccessController.doPriviledged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at sun.misc.Launcher$AppClassLoader.loadClass(Laucher.java:301)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:247)</p>
  
  <p>could not find the main class:jar/usr/lib/wordcount.jar</p>
  
  <p><img src="https://i.stack.imgur.com/go1xL.png" alt="the exception tree is here"></p>
  
  <p>i am using the Hortonworks+Sandbox+1.3+VirtualBox+RC6 this version on a 64 bit  machine .</p>