title: NoClassDefFoundError Error in Hadoop
body: <p>So after going through many posts on SO and revising some java basics, I still get this error</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/io/Writable
  at java.lang.Class.getDeclaredMethods0(Native Method)
  at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
  at java.lang.Class.getMethod0(Class.java:2694)
  at java.lang.Class.getMethod(Class.java:1622)
  at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
  at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
  </code></pre>
  
  <p>I know the difference between <code>java.lang.NoClassDefFoundError</code> and <code>ClassNotFoundException</code> in Java, and have looked through what usually causes it. In a nutshell, it is because some class is unavailable to the program during Run Time but is available during Compile time. Hence I get no compile time errors.</p>
  
  <p>I have added two classpaths, one to <code>commons-logging-1.1.3.jar</code> and the other to the <code>hadoop-core.*jar</code>.
  I am pretty confident that the classpaths are correct.</p>
  
  <p>Here are the imports in my Program</p>
  
  <pre><code>import java.io.*;
  import org.apache.hadoop.io.SequenceFile;
  import org.apache.hadoop.io.SequenceFile.*;
  import org.apache.hadoop.io.SequenceFile.Writer;
  import org.apache.hadoop.io.*;
  import org.apache.hadoop.fs.FileSystem;
  import org.apache.hadoop.io.Writable;
  import org.apache.hadoop.fs.Path;
  import org.apache.hadoop.conf.*;
  import org.apache.hadoop.conf.Configuration;
  import org.apache.hadoop.io.IntWritable;
  import org.apache.hadoop.*;
  </code></pre>