Is there a programatic alternative to setting the dock:name Java Mac OS X property by doing
java -Xdock:name="My App Name" -jar myapp.jar
, or is this the only way to set the dock:name property?
It's been a while, but I believe you need to do the following (this is assuming you're using Swing):
main()
method in a separate class from the JFrame.For example:
public class Launcher {
public static void main(String[] args) {
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Hello World!");
JFrame jframe = new MyJFrame();
jframe.setVisible(true);
}
}
The Apple extensions are documented here: http://developer.apple.com/mac/library/documentation/Java/Reference/1.5.0/appledoc/api/overview-summary.html
I looked at com.apple.eawt.Application
, which gives you access to the icon and menus... but not title, unfortunately.
I am guessing the prescribed approach is to roll out your own App Bundle, as detailed here: http://developer.apple.com/Mac/library/documentation/Java/Conceptual/Java14Development/03-JavaDeployment/JavaDeployment.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With