title: java.lang.NoClassDefFoundError for external library
body: <p>I have a simple program that parse csv file into json objects. 
  I added json.simple-1.1 into my maven. The content of my maven is like this:</p>
  
  <pre><code>    &lt;groupId&gt;IoT&lt;/groupId&gt;
      &lt;artifactId&gt;ETL2&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
      &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.googlecode.json-simple&lt;/groupId&gt;
          &lt;artifactId&gt;json-simple&lt;/artifactId&gt;
          &lt;version&gt;1.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
  
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;!-- Build an executable JAR --&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.0.2&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;archive&gt;
                          &lt;manifest&gt;
                              &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                              &lt;classpathPrefix&gt;lib/&lt;/classpathPrefix&gt;
                              &lt;mainClass&gt;ETL2&lt;/mainClass&gt;
                          &lt;/manifest&gt;
                      &lt;/archive&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt; 
  </code></pre>
  
  <p>I try to execute the jar artifact in the terminal. 
  I get these errors. </p>
  
  <blockquote>
    <p>Error: A JNI error has occurred, please check your installation and
    try again <strong>Exception in thread "main" java.lang.NoClassDefFoundError:
    org/json/simple/parser/ParseException     at</strong>
    java.lang.Class.getDeclaredMethods0(Native Method)    at
    java.lang.Class.privateGetDeclaredMethods(Class.java:2701)    at
    java.lang.Class.privateGetMethodRecursive(Class.java:3048)    at
    java.lang.Class.getMethod0(Class.java:3018)   at
    java.lang.Class.getMethod(Class.java:1784)    at
    sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
      at
    sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
    <strong>> Caused by: java.lang.ClassNotFoundException:
    org.json.simple.parser.ParseException     at</strong>
    java.net.URLClassLoader.findClass(URLClassLoader.java:381)    at
    java.lang.ClassLoader.loadClass(ClassLoader.java:424)     at
    sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)     at
    java.lang.ClassLoader.loadClass(ClassLoader.java:357)     ... 7 more</p>
  </blockquote>
  
  <p>I read in here that </p>
  
  <blockquote>
    <p>This is caused when there is a class file that your code depends on
    and it is present at compile time but not found at runtime. Look for
    differences in your build time and runtime classpaths.</p>
  </blockquote>
  
  <p>That's why I suspect that my maven configuration might not be correct. </p>