How Do I Package Class Or JAR Files Into a Bundle

This section gives directions on packaging up Java class files or a JAR file into a double-clickable application. To package your application, you must specify (at a minimum) the main class name, the classpath, and any additional files required outside of the class files or the JAR file.

To package your application,

  1. In Jar Bundler’s Build Information pane, specify the class containing the main method. It’s easiest to click “Choose...” and navigate to the JAR file or the class file containing the method. After doing this, Jar Bundler displays all the classes containing a main method in the popup button. Jar Bundler also automatically adds the JAR file or the class file to the list of resources to include in the bundle.

  2. If any arguments need to be passed to the main method, put them in them in the Arguments to Main text field.

  3. Add any additional files needed by your application. This might include graphics, sounds, or additional JAR and class files. In the Classpath and Files pane, click “Add...” in the Additional Files and Resources box. This will pop up a dialog where you can navigate the filesystem and choose files to include.

  4. Make any additions to the classpath as needed. Be sure that $JAVAROOT/ is included; this is the directory inside the bundle where files you want to include are placed, including the JAR file or the class file containing the main method.

  5. To finish, click “Create Application...”. From here you can select where the bundle is generated and give it a name. This will be the name that Jar Bundler gives the final application bundle.

Having finished these steps, you now have a double-clickable Java application, which appears just like any other Mac OS X application. If you're curious about how the bundle is laid out, control-click the application in the Finder, and choose Show Package Contents.