| Deploying SWT Applications on Mac OS XUnder Mac OS X, applications are stored in an application bundle, which is simply a directory containing the executable and any associated resources for an application. An application bundle has the extension .app and appears as a single file in the Finder. These application bundles are usually distributed inside compressed disk images with the extension .dmg. Disk images are automatically mounted on download, presenting the user with the bundle icon so it can be dragged to their Applications folder. More information on application bundles and disk images can be found in the Software Distribution section of the Apple documentation.
SWTHello.dmg is a disk image of a simple SWT Hello World application. What's in the .app directoryThe SWTHello.app directory contains the following files:
Info.plist is an XML file describing the application name and description, vendor, icon, and executable to run. The Property List Editor application can be used to edit this file. The .icns file is our icon, and swthello is a small shell script. The SWT .jar and .jnilib files are from the Mac OS X download of SWT from the SWT homepage. Launching the applicationIn the SWTHello example, a small shell script is used as the executable to run. This allows us to easily launch Java with any required options.
(NOTE: If you are using eclipse 3.2.2 or earlier, you also need -Djava.library.path=..)
The shell script launches java with the required classpath and Java
library path settings to use SWT. The Creating a disk imageDisk images can be created on the command line using hdiutil or graphically using the Disk Utility application.
A DMG file can optionally be "internet-enabled", which streamlines the installation process, automatically mounting and copying the application to the Desktop.
Now that wasn't so bad, was it? |