title: How to run a Hadoop program?
body: <p>I have set up Hadoop on my laptop and ran the example program given in the installation guide successfully. But, I am not able to run a program.  </p>
  
  <pre><code>rohit@renaissance1:~/hadoop/ch2$ hadoop MaxTemperature input/ncdc/sample.txt output
  Exception in thread "main" java.lang.NoClassDefFoundError: MaxTemperature
  Caused by: java.lang.ClassNotFoundException: MaxTemperature
  at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
  Could not find the main class: MaxTemperature.  Program will exit.
  </code></pre>
  
  <p>The book said that we should set a Hadoop Classpath by writing</p>
  
  <pre><code>rohit@renaissance1:~/hadoop/ch2$ export HADOOP_CLASSPATH=build/classes
  </code></pre>
  
  <p>The main class is defined in MaxTemperature.java file that I am executing. How do we set the Hadoop Classpath? Do we have to do it for all program execution or only once? Where should I put the input folder. My code is at /home/rohit/hadoop/ch2 and my Hadoop installation is at /home/hadoop. </p>