Thursday, July 21, 2005 03:19 PM
Hi folks, This isn't really a question; rather a suggestion for place where to gather information. I recently made meself an automatation for packaging the multi-platform java app i'm working on into a Mac application bundle. This is what it's all about: Create a directory structure like the following: [appname]/ [appname]/Contents/ [appname]/Contents/MacOS [appname]/Contents/Resources [appname]/Contents/Resources/Java where [appname] be the application's desired display-name. This structure has to be filled with the data following: [appname]/Conten
This isn't really a question; rather a suggestion for place where to gather information.
I recently made meself an automatation for packaging the multi-platform java app i'm working on into a Mac application bundle.
This is what it's all about:
Create a directory structure like the following:
where [appname] be the application's desired display-name.
This structure has to be filled with the data following:
- [appname]/Contents/Resources/Java/[the actual jar file]
- Ad 1) Info.plist is a special XML file. More about it later.
- Ad 2) PkgInfo is a plain file with for sole content the chars "APPL????" in ascii
- Ad 3) This file was copied from some Mac. Was found in the directory: /System/Library/Frameworks/JavaVM.framework/Versions/Current/Resources/MacOS/JavaApplicationStub
- Ad 4) Some 128x128 px icon file, in the mac-icns format. CocoThumbX transformed my png well. This icon is referred of in the Info.plist
- Ad 5) The core. I suppose further jar resources would go here, but i needed those not.
I'm packaging this on a linux machine, but the mac needs UTF-8. So
the only file that contains text (in my case):
iconv --from-code=ISO-8859-1 --to-code=UTF-8 [appname]/Contents/Info.plist
I tried to zip this stuff, but it failed on file permissions, which weren't taken care of by zip, or at least this was what it looked like after unpacking it. However, for the app to be executed, the
needs its execute-bit to be set. Dead end.
So i went the more complete way:
mkhybrid -hfs -hfs-unlock -hfs-volid [displayname] -o appfile.dmg -root [appname] [appname]
aka Schilling-cdrecord, called from the dir above the directory structure described earlier. This gives a handy .dmg file the mac will mount when doubleclicked on, from which the user can drag the app whereever he wants.
is displayed as the dialog's title when the file is mounted. Had the problem i could not pass special chars here, but it wasn't tragic. The encoding of the filenames was prettily taken care of by mkisofs.
is there because the command seemed too short to me otherwise. I didn't notice an effect.
's manpage stated something about an icon i could put in there, being fancy somehow. Therefore i put a hidden .icns file in the image's root, after renaming it to "Icon
" (yes, that's a carriage return. Let's shoot someone), as stated. But it didn't work, so i gave it up. Maybe something changed - the mkisofs's manpage ain't that new.
That's it. Makes a sweet ant script.
You seemingly can make it more complicated than that, putting different parts for different "localizations", what you'd have to alter the directory structure for. But i needed it not, it's handled in the app itself.
Now comes the Info.plist part. Finding the syntax is quite easy. Google. What i weren't able to find were precise descriptions of possible keys and their effects.
Note that when the Info.plist file is interpreted, you have in your environment two special variables:
i'm not sure whether it points to the /Contents dir or to the one above
points to [appname]/Contents/Resources/Java/
So these are those i found:
[root of the plist]
Displayed under the icon on the desktop, as a tooltip in the dock, maybe elsewhere.
?? Displayed in the "about", i believe.
Displayed in the "Get Information" window
The aforementioned "JavaApplicationStub" comes in here.
?? possible values ? (default: "English")
"APPL", the first four bytes of the "PkgInfo" file
"????", the four last bytes of the "PkgInfo" file. ???? means "mac does not know you". Damn, that hurts.
The icon file in $APP_ROOT/Contents/Resources. Displayed here and there. Especially on the desktop.
Then there is a further dict for the key "Java". This one has the keys:
Like in the MANIFEST.MF
Java-version requirement. Google's full of this one. Looks like it makes some problems.
I specify my jar here using
Then a key
listing another dict:
Should make your JMenuBar being integrated in the Mac's sole menu-bar. Haven't used it though.
?? Something to override that Human-Interface stuff of Apple's concerning tabbed panes
?? As opposed to dead-resize. More flexible, i guess.
Is being put in the menubar as the app's name. MUCH better than edu.xxx.snuff.Stiff.Main....
Supposed to increase your window's size so that mac's resize box doesn't, as it is called, "intrude". However, using 1.4.2, i didn't notice a difference (it still intrudes).
I'd be glad if someone who has been working on this too could correct here and extend there.