Resource picture not found[SOLVED]

Hello everyone!
I have searched a lot but still don’t manage to find the resource file icon.png getting ImageIO exception!

Sprite sprite = new Sprite(ImageIO.read(Game.class.getResourceAsStream("/icons.png")));

where

public Sprite(BufferedImage image) {
		"something"
		}

Here is how my package tree looks like.
package—>src->Game.java
|->res->icons.png
*I have tried deleting /
*I have tried adding source lookup path
*I have tried putting the full c:/games/…/icons.png path
Thank you in advance!

well ist not

"/icons.png"

but

"res/icons.png"

It will never find the “res” folder because it’s not on the build path. The easiest way is to just move the “res” folder to under “src” and then doing “/res/icons.png”.

I always put “res” same place as “bin” and “src” then call “res/blah” :slight_smile:

To be able to do that, you need to right click “res” and choose Build Path -> Use As Source Folder. But it’s easier for exporting to just put it under “src”.

Yes. That’s what I missed. (Building the path). Thank you very much! :slight_smile: