up previous next contents
Up: java-on-mac Previous: Create application Next: Fixing the problems with   Contents

Troubleshooting my Jar Bundler problems

To troubleshoot my problems I first need to know what creating an application on the Mac really does. For someone like myself who hasn't created any native Mac applications yet, this is where Jar Bundler helps quite a bit. It got me started in the right direction, and hopefully I can learn from what it did for me.

The first thing to know is that what an end user sees as an "application" on the Mac is really a Unix directory. It's a special directory, but only in the sense that it ends with the .app extension, which the Mac recognizes as an application.

As an example, when I open a Terminal window and use the ls -ld Wiki* command in my working directory (where I created my application), the output look like this:

drwxr-xr-x   3 al  al  102 Sep  8 15:31 WikiTeX.app

The full name of the "file" that was created is WikiTeX.app (the name in the last column), and the 'd' character in the first field indicates that this "file" is really a directory.

WikiTeX.app directory

Okay, if my Mac application is really a directory, what's in the directory?

Here are my directory contents, displayed with the Unix find command:

prompt> find WikiTeX.app

This listing shows that the directory WikiTeX.app contains a subdirectory named Contents, and Contents contains other files and directories, as shown in the list.

Right away I see that the directory WikiTeX.app/Contents/Resources/Java contains my index.html file, my jar files, and the JPG image I wanted to use. But, it doesn't reference my other "help" directory at all, so that's a major reason why the help functionality doesn't work.

Looking at that list, I know what everything is except for these entries:


So I'll dig into these and see what they are.

The WikiTeX.app/Contents/PkgInfo file

The WikiTeX.app/Contents/PkgInfo file is a plain text file that contains only one line:


This is a concatenation of the application type and signature that I entered in the Jar Bundler Properties panel (the default values, actually), so there's nothing for me to do here.

The WikiTeX.app/Contents/MacOS/JavaApplicationStub file

The WikiTeX.app/Contents/MacOS/JavaApplicationStub file is a binary executable file, as you can see with the file command:

my_prompt> file WikiTeX.app/Contents/MacOS/JavaApplicationStub
WikiTeX.app/Contents/MacOS/JavaApplicationStub: Mach-O universal binary with 2 architectures
WikiTeX.app/Contents/MacOS/JavaApplicationStub (for architecture i386): Mach-O executable i386
WikiTeX.app/Contents/MacOS/JavaApplicationStub (for architecture ppc):  Mach-O executable ppc

This is a small program supplied by Apple to bootstrap your Java application. When your application icon is clicked, this program is run, and it then loads your application in a JVM.

The Info.plist file

The WikiTeX.app/Contents/Info.plist file is where all the action is. As you can see in the listing below, this is an XML file contains almost all of the information I specified when using Jar Bundler.

<?xml version\texttt{"1.0" encoding}"UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
  <string>WikiText by Alvin Alexander, Version 0.92</string>
            \item 5+</string>

(Note: I modified the formatting of this file so it would display better here.)

Knowing that this file controls everything, hopefully I can fix the problems with my application.