|
Troubleshooting my Jar Bundler problemsTo 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 directoryOkay, 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 WikiTeX.app WikiTeX.app/Contents WikiTeX.app/Contents/Info.plist WikiTeX.app/Contents/MacOS WikiTeX.app/Contents/MacOS/JavaApplicationStub WikiTeX.app/Contents/PkgInfo WikiTeX.app/Contents/Resources WikiTeX.app/Contents/Resources/Java WikiTeX.app/Contents/Resources/Java/index.html WikiTeX.app/Contents/Resources/Java/jazzy-core.jar WikiTeX.app/Contents/Resources/Java/JFontChooser.jar WikiTeX.app/Contents/Resources/Java/wikitex.jar WikiTeX.app/Contents/Resources/the-cat.jpg 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:
WikiTeX.app/Contents/Info.plist WikiTeX.app/Contents/MacOS/JavaApplicationStub WikiTeX.app/Contents/PkgInfo So I'll dig into these and see what they are.
The WikiTeX.app/Contents/PkgInfo fileThe WikiTeX.app/Contents/PkgInfo file is a plain text file that contains only one line:
APPL???? 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 fileThe 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 fileThe 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"> <dict> <key>CFBundleName</key> <string>WikiTeX</string> <key>CFBundleIdentifier</key> <string>com.devdaily.opensource.jelly.Main</string> <key>CFBundleVersion</key> <string>0.92</string> <key>CFBundleAllowMixedLocalizations</key> <string>true</string> <key>CFBundleExecutable</key> <string>JavaApplicationStub</string> <key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> <string>0.92</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleGetInfoString</key> <string>WikiText by Alvin Alexander, Version 0.92</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleIconFile</key> <string>the-cat.jpg</string> <key>Java</key> <dict> <key>WorkingDirectory</key> <string>$APP_PACKAGE/Contents/Resources/Java</string> <key>MainClass</key> <string>com.devdaily.opensource.jelly.Main</string> <key>JVMVersion</key> \begin{newenumerate} \item 5+</string> \end{newenumerate} \end{newenumerate} \end{newenumerate} \end{newenumerate} <key>ClassPath</key> <array> <string>$JAVAROOT/wikitex.jar</string> <string>$JAVAROOT/jazzy-core.jar</string> <string>$JAVAROOT/JFontChooser.jar</string> <string>/Users/al/AlsLife/DD/Projects/MyEditor/jarfiles/latexHelpFiles/</string> </array> </dict> </dict> </plist> (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.
|