Can't seem to load the art with webstart

For my test code I have my image files in the programs jar file. This normally load fine with the below call…

getClass().getClassLoader().getResource(“game_art/front.png”).getPath()

but when I enable the webstart, the file path is not the same and it errors on loading the file. Everything else seems to work fine up to this point.

Is there a special way to load your game resources from the java jar when doing a webstart?

Are you trying to then open a file on that path? The way to do it is to actually open the resource as an InputStream instead, eg.

InputStream in = getClass().getClassLoader().getResourceAsStream("game_art/front.png");

Holly cow, that worked!!

Thanks you sooooo much. I would have never guessed that is what I needed to do.

I made a web start and “bam”, it also runs on my linux box. I assume it will run just as easily on a Mac.