Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I write in my terminal, java -jar myJar.jar, it gives me an error "Resource Not found res/playNow.png" When I run it in eclipse, it does not give me any errors about this image.

My folder in my eclipse is outside my package called res and inside it are images.

This is the full error

Exception in thread "main" java.lang.RuntimeException: Resource not found: res/playNow.png
    at org.newdawn.slick.util.ResourceLoader.getResourceAsStream(
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(
    at org.newdawn.slick.Image.<init>(
    at org.newdawn.slick.Image.<init>(
    at org.newdawn.slick.Image.<init>(
    at org.newdawn.slick.Image.<init>(
    at javagame.Menu.init(
    at javagame.Game.initStatesList(
    at org.newdawn.slick.state.StateBasedGame.init(
    at org.newdawn.slick.AppGameContainer.setup(
    at org.newdawn.slick.AppGameContainer.start(
    at javagame.Game.main(

I'm using a terminal in my mac. How do I fix the error Resource Not Found? I'm using slick2d!

share|improve this question

Your resource folder has to be in the classpath. Just copy this folder in the folder holding the jar file and it should work. When you run your project in eclispe, the IDE already has settings that make it works. If you run the plain command java -jar myjar.jar java does not know where to look for your resources so it will look into the default classpath ("." e.g the current directory, that's why putting your resources on the same directory as your jar file would work). You can add parameters to the command line to change behaviors, change classpath etc. see the manual.

Also you can read this:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.