Forums Register Login

finding images in netbeans

+Pie Number of slices to send: Send
I've just loaded up netbeans and something called Inno 5 and Wix.
I'm wanting to create an exe for my game (a Java application).
Everything compiles but then it fails when it can't find any images.
I'd read that I should put them in a folder called "resources" at the same level as the "src" folder.

I've tried:
but neither worked. I have a similar problem for loading up wav sounds. Can offer any advice?
Thank you
Mike
1
+Pie Number of slices to send: Send
Hi Mich.

You should position your resources relative to your application's class path. You can either put your resources in the src folder, or put them in a separate folder (like res, resources, img, images, etc...) and then add the folder to your application's class path. You can also store them in a jar and add the jar to the class path.

getResource("ship.png") will look for the resource in com/example/ship.png. If you want the resources at the top, you should look for "/ship.png" instead.
+Pie Number of slices to send: Send
Thanks, it's working now.
I do have other issues (trying to pass java directives ie java2d.nodraw=true) but it's probably best I start a new thread rather than confuse this one.
Mike
them good ole boys were drinking whiskey and rye singin' this'll be the day that I die. Drink tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 616 times.
Similar Threads
Reading icon using ImageIO.Read
Image smoothing
display image for complete noob
Problem with ImageIO.write
Image not appearing on button
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:15:05.