Java Reference
In-Depth Information
Figure 21-4. Files in the Java application directory on Mac OS X
As you can see, there is one directory
Contents
with two subdirectories:
MacOS
and
Re-
sources
.
Contents/MacOS
contains the executable program, in the Java case
JavaApplica-
tionStub
, a native-language Java launcher for Mac OS (provided with the Developer Tools
package).
Contents/Resources/*.icns
contains icons in various resolutions for display by the
Finder; this file can be created using the
IconComposer
program (found in
/Developer/Ap-
plications/Utilities/Icon Composer.app
). The directory
Contents/Resources/Java
contains
your Java classes and/or JAR files.
Contents/Info.plist
ties the whole thing together, specify-
ing the names of the various files, the file types your application can open, and other inform-
ation.
The better commercial installer tools (discussed in
“Write Once, Install Anywhere”
)
generate
this structure for you. You can create this structure using Ant. Eclipse 3.0 (since “Milestone
7”) can generate a Mac OS X application. Just select your Project in the Eclipse navigator,
select Export Mac OS X application from the Export menu, and fill in two screens specifying
the output destination and some other information, as shown in
Figure 21-5
. In the case of
Ant or Eclipse, you probably want to use Disk Copy to build a
dmg
(disk image) file of your
directory;
dmg
files can be downloaded by Mac OS X users and are normally expanded auto-
matically upon download to re-create the Application Bundle.