Retired Document
Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid.
Application Packaging
An OS X application bundle should contain all the resources an application needs to run. This includes JAR files, class files, and libraries the program depends on. That is, there should be no dependencies on any resources that are not contained within the bundle.
This chapter guides you through the creation of an OS X application bundle that groups the resources of a JAR-file based Java application.
Creating an Application Package
To illustrate application-bundle creation using Jar Bundler, this section shows how to package the Xerlin Java application as an OS X application package.
Follow these steps to create a package for the Xerlin application. Xerlin is an open-source project that aims at delivering a full-feature XML editor. You can get the Xerlin software from three sources:
The Xerlin website at http://www.xerlin.org/.
This document’s companion files in your computer (see Introduction to Jar Bundler User Guide for details).
The OS X Java website at http://developer.apple.com/java/.
The example that follows assumes that the Xerlin version is 1.2_1, which is the one provided in the companion files of this document.
Follow these steps to create an OS X application package:
Launch Jar Bundler. It’s located in
/Developer/Applications/Java Tools/
.In the Build Information pane, enter the fully qualified name of the application’s main class in the Main Class text input field.
If necessary, look in the
MANIFEST.MF
file of the main JAR file or in the application’s documentation.For Xerlin, the main class is
org.merlotxml.merlot.XMLEditor
.Make any necessary selections in the rest of the elements. For more on what each element means, read Build Information Pane.
For example, to make the Xerlin menu bar look familiar to an OS X user, select Use Macintosh Menu Bar. Also choose the
Xerlin.icns
file as the application’s icon.Figure 2-1 shows the Build Information pane for the Xerlin application bundle.
Add the code resources needed by the application. These include JAR files, class files, and libraries:
Click the Classpath and Files tab.
In the Classpath and Files pane, click Add.
Navigate to the folder that contains the main JAR file, select the file, and click Choose.
Repeat for any other required code resources.
Figure 2-2 shows the Classpath and Files pane for the Xerlin application bundle. For more information on the Classpath and Files pane, read Classpath and Files Pane.
Configure the packages’s properties.
Click the Properties tab.
Enter the appropriate information in the Properties pane.
For example, enter
1.2_1
in the Version text field,org.xerlin
in the Identifier text field, and1.2_1 Copyright SpeedLegal Holdings, Inc.
in the Get-Info String text field, as shown in Figure 2-3.For more on the elements in the Properties pane, read Properties Pane.
Create the application bundle.
Click Create Application.
In the dialog that appears, navigate to the location in which you want the application bundle to reside, enter a name for the package in the Name text field, and click Create.
When done, you get a package that looks an behaves like a native Mac app, as shown in Figure 2-4.
If the Finder doesn’t show the icon you chose in Jar Bundler, try one of the following remedies (if the first one doesn’t work, try the second one, and so on):
Relaunch the Finder.
Press Option–Command-Esc, select Finder in the application list, and click Relaunch.
Log out and log in.
Delete
~/Library/Caches/com.apple.LaunchServices.UserCache.csstore
, log out, and log in.Delete
/Library/Caches/com.apple.LaunchServices.LocalCache.csstore
, and restart your computer.
Copyright © 2003, 2009 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2009-12-01