Options to put your Java application name on the Mac menubar

If you don't do anything to your Java application on a Mac OS X system, your Java class name will appear in the Mac menubar. Of course, this isn't a good thing. There are a couple of things you can do to get the name of your Java application on the Mac menu bar, and I'll share all of the ways I know how to do this. I've listed these techniques in order here from "easiest" to "best".

Use the Mac Java Xdock command line properties

One way to tackle this problem is to specify some custom command line arguments when you start your Java application. In short, you can start your Java application something like this:

java -Xdock:name="My Application" ... (whatever else you normally specify here)

I don't recommend this approach for commercial applications, but it is one possible approach.

Set specific Java Mac properties in your application

A second way to get your Java application name on the Mac menu bar is to set a couple of properties very early in your Java application startup process. You'll want to specify these two properties:

System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "ImageRotator");

I discuss this approach in greater detail in this Java Mac application name menubar tutorial.

Make your Java application look like a native Mac application

The best approach I can recommend is to build your Java application to make it appear to your users to be a complete native Mac application. I describe this process in great detail in these two Mac Java application tutorials:


I hope this collection of tips to get your Java application name on the Mac menu bar are helpful. These are all the ways I know to get your Java application name on the Mac menu bar, and I've listed them here in order from "easiest" to "best".