How to load an image......?

URL monkeyLoc;

monkeyLoc = HelloStates.class.getClassLoader().getResource("jmetest/data/images/Monkey.png");



i am trying to display an image over a box…when i try to load Monkey.jpg over the box it worked…

this Monkey.jpg was present on above folder(path) already as when i installed jme in c:/jme/src/jmetest/data/images…



but when i try to load different image say paint.jpg…URL monkeyLoc;

monkeyLoc = HelloStates.class.getClassLoader().getResource("jmetest/data/images/paint.png");

i have put paint.jpg at the same folder where Monkey.jpg is…



it doesn't work…warning appears saying "Could not load image…URL was null…deafultTexture used…"…



Again when i load Monkey.jpg it works…but for my other images it doesn't work…i have tried  by putting my paint.jpg on different location but still doesn't work…same default image saying "missing tecture" get renders…



can anybody tell me why its happening…?

Are you using the same class?

If not, is your class in the same folder as HelloStates?



Also, are you trying to load paint.jpg instead of paint.png?

yeah i am usiong the same class HellloStates …i have changed only image file name…just wanted to experiment with

other images…but its not working with other images…and i have tried paint.png also…but its not working…

Your filename has to match your image name, including extension.  In your post you said you have a paint.jpg in the folder, but the code says you're trying to load paint.png



You could be getting an error if trying to load a wrongly formatted file type (like if you had paint.jpg and renamed the extension to png).