Need help to get webstart working with resources.

Started by doctorpunk, June 21, 2011, 11:46:03

Previous topic - Next topic


Hi guys. I noticed a helpful webstart thread on the front page however it didn't quite help me so I'll post this one.

I'm trying to get my first game type thing working with webstart.

This is the first time i've attempted to run something outside of netBeans. My program appears to just open and then shut straight away when I use webstart.

I'm quite sure i've got the security signatures, jar files and jnlp file right. The problem is most probably loading resources.

        texture[0] = TextureLoader.getTexture("PNG", new FileInputStream("stonewall02.png"));
        texture[1] = TextureLoader.getTexture("PNG", new FileInputStream("stonefloor01.png"));

Those are examples of the lines that load the data in my program.. Worked fine in netbeans with the files in the project folder.

What do I change these lines to, and where do I put them in relation to my jar files to get it working properly?

I've read that it could be Resources.class.getClassLoader().getResource("path/to/logo.png"); however i'm not sure where the Resources object is.

Thanks for your help!


you are on the right track.

here is how I load a texture right now in an applet:

TextureLoader.getTexture("PNG", Sprite.class.getClassLoader().getResourceAsStream(imagepath) );

imagepath is a string path relative to the "src" directory.

I was having that problem last week myself :)

If you are still having problems, make sure the path doesnt start with a slash or anything like that. So something like


should be