title: NoClassDefFoundError when running java program in linux/ubuntu
body: <p>I'm unable to run my java program in linux/ubuntu.<br>
  I've been working on this problem for a whole day now and can't seem to find any solution. 
  I wrote a small java program using Eclipse on my Windows 7 machine and it works just fine. Here's my code:</p>
  
  <pre><code>//start of java program jsonReader
  package jsonReader;
  //imports needed to run program
  import java.io.FileNotFoundException;
  import org.codehaus.jackson.map.*;
  import org.codehaus.jackson.*;
  </code></pre>
  
  <p>In order for the import org.codehause.jackson.. to work, I had to manually include in my project this jar file: jackson-all-1.9.11.jar</p>
  
  <pre><code>    //class jsonReader
      public class jsonReader {
      //start of main 
              public static void main (String[] args) throws FileNotFoundException {
  </code></pre>
  
  <p>The rest of this is my program which works just fine.</p>
  
  <p>The next step to my project is to run it on Ubuntu - command line. I did an export on Eclipses:
          File -> Export -> General -> Archive File -> and created a Zip File. </p>
  
  <p>This zip file was transferred to my linux/ubuntu enviornment. From there, I unzipped the file. This is the directory structure:</p>
  
  <p>in home directory I have:</p>
  
  <pre><code>/jsonReader --&gt; has the following directories in it:
                 -/bin/jsonReader/jsonReader.class
                 -/lib/jackson-all-1.9.11.jar
                 -/src/jsonReader/jsonReader.java
                 -.classpath (file); and a few other files.
  </code></pre>
  
  <p>In /jsonReader/src/jsonReader I run this command: javac jsonReader.java --> I get this error:</p>
  
  <pre><code>    jsonReader.java:6: package org.codehaus.jackson.map does not exist
      import org.codehaus.jackson.map.*;
      ^
      jsonReader.java:7: package org.codehaus.jackson does not exist
      import org.codehaus.jackson.*;
      ^
  </code></pre>
  
  <p>Then I run this command: </p>
  
  <pre><code>javac -classpath /jsonReader/lib/jackson-all-1.9.11.jar jsonReader.java 
  </code></pre>
  
  <p>I get no errors. This command creates a jsonReader.class file in the /src/jsonReader directory. I try to run the file using this command:</p>
  
  <pre><code>java jsonReader 
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: jsonReader (wrong name: jsonReader/jsonReader)
          at java.lang.ClassLoader.defineClass1(Native Method)
          at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
          at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
          at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
          at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
          at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
          at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
  Could not find the main class: jsonReader. Program will exit.
  </code></pre>
  
  <p>This is the entire error message that I'm getting, when running this on the command line.</p>
  
  <p>I'm not sure why I'm getting this error and how to resolve it.</p>