up previous next contents
Up: java-on-mac Previous: Troubleshooting my Jar Bundler Next: Jar Bundler as an   Contents

Fixing the problems with my application

To recap, in an attempt to use the Mac Xcode Jar Bundler application to bundle my Java application, I have three problems:

  1. My application's JMenuBar is not on the Mac menu bar.
  2. My application's "help" functionality isn't working.
  3. My desired application icon is not being used.

So, let's see what I can fix.

Problem 1: JMenuBar not on the Mac menu bar

Interestingly, the Info.plist file doesn't have any reference to the apple.laf.useScreenMenubar property, even though I selected the "Use Macintosh Menu Bar" checkbox on the Build Information panel. If they don't use that property as an external JVM setting, I don't know how this should work, unless a different version of the JavaApplicationStub is provided when I select that checkbox.

Well, this should be a clue, but ... the short story is that I have not been able to get the menu bar of my old application to display on the Mac menu bar. I tried several things, all centered on trying to use the -Dapple.laf.useScreenMenuBar=true JVM parameter.

For example, one thing I tried was adding the -Dapple.laf.useScreenMenuBar=true JVM parameter to the Properties tab, then re-generating my file with Jar Bundler. This creates the following entry in the inner dict section of the Info.plist file:

<key>VMOptions</key>
<string>-Dapple.laf.useScreenMenuBar=true</string>

but again, this did not work, and several other variations I tried did not work.

I'd dig into this harder, but ... in my case I'm lucky, because my newer WikiTeX application sets the JMenuBar on the Mac menu bar within my Java code. It seems like this will be a problem for other developers that don't want to modify their Java source code. If this is a problem for you I'll be glad to look at it more, just drop me a line.

Note: For more information on this topic, here is a link to an Apple Info.plist document.

Problem 2: Help screens aren't working

Fixing the problem with my help screens is much easier. The problem is that the Jar Bundler took the directory that I specified, but instead of copying it like I hoped it would, it put a hard reference to my directory in the Info.plist file, i.e., this line:

<string>/Users/al/AlsLife/DD/Projects/MyEditor/jarfiles/latexHelpFiles/</string>

The way to fix this problem is to delete that entry, and copy my latexHelpFiles directory into the WikiTeX.app/Contents/Resources/Java directory. After copying that folder and restarting my application the help screens now work fine.

Note: I could probably fix this problem by putting all my help files in a jar file, and I probably will do that later. Right now they're in a state of flux, and I prefer this approach at this time.

Problem 3: My icon is not being used

The JPG image I supplied for the application is not being used, and, after a little research, it turns out that I just need to supply my desired icon in Apple's .icns format. That's a whole other tutorial, but again, when I converted my image to the proper format everything worked just fine.

Update: I have figured out how to create Mac ICNS icon files, for free. Just look at the "Mac ICNS icon" section on this Mac Java Ant Jarbundler task page for more information.

Problems solved

I was able to solve the problems I was having with my help screens not working, and my application icon not showing up, so I'm really happy with that. I couldn't solve the problem with my JMenuBar not showing up on the Mac menu bar, but as I mentioned, my newer Java code handles this, so it's not really a problem for me.