finding images in netbeans
posted 11 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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
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
Arcade : Alien Swarm
Board : Chess - Checkers - Connect 4 - Othello
posted 11 years ago
-
1 -
-
Number of slices to send:Optional 'thank-you' note:
-
-
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.
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.
Mich Robinson
Ranch Hand
Posts: 287
2
posted 11 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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
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
Arcade : Alien Swarm
Board : Chess - Checkers - Connect 4 - Othello
| it's a teeny, tiny, wafer thin ad: Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |







