1. /dactylo/ - here reside every .class file2. /data/ - text files with data in it like the properties file3. /data/lessons - text files with lessons needed4. /gfx/ - all the images are in here

My program is packaged in "package dactylo;" and when I start my program in eclipse, everything works fine.

I got the following methods accessing components outside the package:

1. I read the content of /data/lessons with:

File dir = new File("data/lessons");

2. I read several images all using

Toolkit.getDefaultToolkit().getImage("gfx/image_name");

3. I read a properties file using:

properties.load(new FileInputStream("data/dactylo.properties"));

My question is, when I package everything inside a .jar file, the images won't load, the File returns a NullPointerException and the property file doesn't load. I know there is a problem with relative filenames and stuff but I don't know how to resolve the problem.

When I copy the folders data and gfx to the jar file, everything works fine, but I want to use webstart to deploy my software and as I know, everything has to be inside jar files to actually make them load.

You can't have a FileInputStream, it tries to read from a file on disk, when you use webstart you have to read all your resources as streams, like in the image-example above, try: InputStream fis = this.getClass().getResourceAsStream("/lessons.jar");

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org