I am developing a little game where I use some pictures for the sprites etc etc.
It works just fine when I load it from the disc like this
Image image = new Image("C:\\AppleMan.png");
but how can I load it from a foloder within the project. I am using eclipse as IDE and the language is Java 🙂
I took a screenshot of a sample project so you can see how I have importet the picture

So I want to load the picture from that resource folder like this pseudo code
Image image = getResource("Resources/AppleMan.png");
but that simply doesn’t work.
Any help appreciated 🙂
1) You should add Resources folder to classpath
2) You should locate file absolutely, i.e. “/Resources/AppleMan.png”
P.S.
3) Sorry, also note that getResource returns URL: http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html#getResource%28java.lang.String