title: Java: NoClassDefFoundError in maven project?
body: <p>I've started developing a 3D java game engine using OpenGL in Codenvy IDE, using Maven. I've configured to run Java 8, and I've set up the dependencies in <code>pom.xml</code> that is required for <code>LWJGL</code>. However, when I run a test window, I get a <code>NoClassDefFoundError</code>. I'm unsure why this happens, considering <code>Maven</code> is configured to store all <code>.Jar</code> dependencies into one filem so accessing them shouldn't be a concern. All the files have downloaded properly into the <code>External Packages</code> directory in my Codenvy project.</p>
  
  <p>Here is the <code>pom.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
     &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
     &lt;groupId&gt;engineTester.First3DEngine&lt;/groupId&gt;
     &lt;artifactId&gt;First3DEngine&lt;/artifactId&gt;
     &lt;version&gt;1.5.7&lt;/version&gt;
     &lt;packaging&gt;jar&lt;/packaging&gt;
  
    &lt;dependencies&gt;  
      &lt;dependency&gt;
        &lt;groupId&gt;org.lwjgl.lwjgl&lt;/groupId&gt;
        &lt;artifactId&gt;lwjgl&lt;/artifactId&gt;
        &lt;version&gt;2.8.4&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;org.lwjgl.lwjgl&lt;/groupId&gt;
        &lt;artifactId&gt;lwjgl_util&lt;/artifactId&gt;
        &lt;version&gt;2.8.4&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;org.lwjgl.lwjgl&lt;/groupId&gt;
        &lt;artifactId&gt;lwjgl_util_applet&lt;/artifactId&gt;
        &lt;version&gt;2.8.4&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;com.typesafe.slick&lt;/groupId&gt;
        &lt;artifactId&gt;slick_2.10&lt;/artifactId&gt;
        &lt;version&gt;3.1.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;java3d&lt;/groupId&gt;
        &lt;artifactId&gt;vecmath&lt;/artifactId&gt;
    &lt;version&gt;1.3.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;4.12&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;2.6&lt;/version&gt;
          &lt;configuration&gt;
            &lt;argLine&gt;-Xmx1024m&lt;/argLine&gt;
            &lt;archive&gt;
              &lt;manifest&gt;
            &lt;addDefaultImplementationEntries&gt;true&lt;/addDefaultImplementationEntries&gt;
          &lt;addDefaultSpecificationEntries&gt;true&lt;/addDefaultSpecificationEntries&gt;
                &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                &lt;classpathPrefix&gt;lib/&lt;/classpathPrefix&gt;
                &lt;mainClass&gt;engineTester.MainGameLoop&lt;/mainClass&gt;
              &lt;/manifest&gt;
            &lt;/archive&gt;
          &lt;/configuration&gt;
        &lt;/plugin&gt;
      &lt;/plugins&gt;
     &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>And here is where I'm getting the issue:</p>
  
  <pre><code>package engineTester;
  
  import org.lwjgl.opengl.Display;
  
  import renderEngine.DisplayManager;
  import util.Console;
  
  public class MainGameLoop {
      public static void main(String[] args){
          new Console();
          DisplayManager.createDisplay();  &lt;-- line which throws the error
          while(!Display.isCloseRequested()){
              //game logic
              //render
              DisplayManager.updateDisplay();
          }
  
          DisplayManager.closeDisplay();
  
      }
  }
  </code></pre>
  
  <p><code>DisplayManager.createDisplay()</code> method:</p>
  
  <pre><code>public static void createDisplay(){
      ContextAttribs attribs = new ContextAttribs(3,2);
      attribs.withForwardCompatible(true);
      attribs.withProfileCore(true);
  
      try{
          Display.setDisplayMode(new DisplayMode(WIDTH,HEIGHT));
          Display.create(new PixelFormat(), attribs);
      } catch (LWJGLException e){
          e.printStackTrace();
      }
  
      GL11.glViewport(0,0,WIDTH,HEIGHT);
  }
  </code></pre>
  
  <p>And finally the full error:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError:     org/lwjgl/LWJGLException
      at engineTester.MainGameLoop.main(MainGameLoop.java:11)
  Caused by: java.lang.ClassNotFoundException: org.lwjgl.LWJGLException
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      ... 1 more
  </code></pre>
  
  <p>Thanks for your help!</p>