Making an Executable JAR

Hello everyone. As my project comes closer to “Alpha Release”, I need to have it as a standalone app versus starting up through Eclipse. Unfortunately, I don’t have much experience with creating executable JARs. I have read through the sun tutorials, but I was not able to get my JAR working, even with Eclipse’s export feature. This may seem like a newbie topic, but any help would be appreciated.

Here are some of the questions I have:

  1. Should I keep my resource (textures, sounds, models, etc.) outside of the jar for both the sake of simplicity, file size, and interchangeability?

  2. How do these files need to be referenced in my class files? Currently, I have something like the following for all of my resources:

URL[] urls = new URL[1];
      urls[0] = PhobiaGame.class.getClassLoader().getResource(

Unfortunately, when I tried to create my JAR last night, a NullPointerException was thrown when it actually tried to use that URL. I had the folder 'sound/...' in the same directory as my JAR, but I'm not sure that was the correct spot for it, or if the URL should even be using the PhobiaGame.class.getClassLoader().getResource() method.

3. Should the extension JARs that I am using (jme.jar, jorbis.jar, jogg.jar, etc.) be included in my JAR, or would it be easier to put them in a lib directory independent of my JAR and simply reference them by adding them to the classpath at exectution time.

4. Similarly, where should the lwjgl.dll files be placed?

Here is my directory structures for reference:

What I would really prefer is to have everything under 'com' in my JAR, and be able to reference files in these other folders which are not in the JAR, but as I stated in question 2, I am having trouble with this.

If you guys know of any good tutorials that you found, or anything from your own experience, I would appreciate the help. Thanks.