Java program works within IDE, but after compiling (eclipse) gives a java.lang.NoClassDefFoundError

Referenced Libraries Structure: (what I did manage to do, runs fine in IDE)


Exception in thread "main" java.lang.NoClassDefFoundError: org/newdawn/slick/SlickException
Caused by: java.lang.ClassNotFoundException: org.newdawn.slick.SlickException
    at java.lang.ClassLoader.loadClass(
    at sun.misc.Launcher$AppClassLoader.loadClass(
    at java.lang.ClassLoader.loadClass(
    ... 1 more

Basically I am using slick and LWJGL to get the audio working, within the IDE it runs fine (build path configured, natives for lwjgl selected), but when compiled and ran, it crashes and in the console it gives above stacktrace.

I am running 64-bit macosx, code written and compiled in eclipse. Libraries used: lwjgl, slick (

ran from "Terminal" console using:

java -cp ~/Desktop/FirstGame.jar

This seems to be a common bug, but after a lot of time searching on the web, I have not come across an answer that solved it.

(edit) Relates to: ERROR!! AppGameContainer java.lang.ClassNotFoundException


I think that you've got a problem with third-party libraries which are not included into your jar (but they can be found in your IDE project's classpath, that's why it works there).

You can place any third-party jars into the /lib directory next to the jar and use -cp JVM argument. Or you can try using tools like, "maven-shade-plugin" plugin for Maven build tool and so on

Does FirstGame.jar a one-jar with all the lib under it ? if not, you will need to include all the required jar files to be added in classpath.

Something like java -cp ~/Desktop/FirstGame.jar;lib/*"

Looks like eclipse couldn't find org.newdawn.slick.SlickException class that is included in Slick. Or you didn't add the Slick.JAR file to the proper place, or your classpath isn't set correctly.

try adding this slickJar in your build path it should solve your problem

I DID IT (I am so proud of myself, I figured it out myself, using a few documentations and some of my brain)

sometimes, you need a little push from somebody to work yourself to the top.

I basically fixed it by going into MANIFEST.MF and adding a line:

as well as moving all the jar files (and the binaries) in a single folder called "Game"

When done correctly it looks something like this:

Need Your Help

Runtime error 1004 Application Defined or object defined error vba

excel vba excel-vba

This code works well but sometimes gives this error..

How to overlay an image over a background in matlab

matlab image-processing overlay

I have an image in which certain pixels are black. And I also have a background image over which I want to overlay my image. But I want the background to appear only where the pixels are black in the