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(ResourceLoader.java:69)
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:169)
    at org.newdawn.slick.Image.<init>(Image.java:196)
    at org.newdawn.slick.Image.<init>(Image.java:170)
    at org.newdawn.slick.Image.<init>(Image.java:158)
    at org.newdawn.slick.Image.<init>(Image.java:136)
    at javagame.Menu.init(Menu.java:31)
    at javagame.Game.initStatesList(Game.java:21)
    at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:164)
    at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:390)
    at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314)
    at javagame.Game.main(Game.java:32)

I'm using a terminal in my mac. How do I fix the error Resource Not Found? I'm using slick2d! There's an image file attached. It is the directory of the res in my eclipse project. This is game development if you don't know slick.

Does the classpath point to the folder containing the res folder when the code is executed?

Is the res folder(and contents) inside the jar file?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.