1

I am displaying a JFrame on OS X and am getting "java" for the name of the application when it is minimized to the dock. I am passing -Xdock:name="Foo", and this is changing the name in the dock when the application is not minimized, but once we minimize the name in the dock is wrong.

To minimize I am calling setExtendedState(JFrame.ICONIFIED).

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433

1 Answers1

1

To get this effect on Mac OS X, you'll need to add the option to your application bundle's Info.plist, as shown in the example cited here.

<key>VMOptions</key>
<string>-Xdock:name=Foo</string>
Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • This does not work for me. We are running a jar from a shell script. The shell script is started from a flash application. Thus, I have no plist. – user3277532 Feb 06 '14 at 16:23
  • You can use `/usr/bin/open` to launch your `.app`. – trashgod Feb 06 '14 at 18:27
  • All i have is a jar file, it will never be a .app. In Net Beans i see this same problem. How could this be fixed so when the jar is run out of Net Beans and the JFrame is iconified, it does not say "java" in the dock. – user3277532 Feb 06 '14 at 18:33
  • Take a working example, like the one cited, replace the `.jar` with your own and edit the `.plist` _ad lib_. Notice that NetBeans itself is an application bundle. – trashgod Feb 06 '14 at 18:41
  • This really didn't help. my jar file is started from a shell script, there is not an app bundle associated with it, like i said above I have no plist. Your solution works during development in netbeans, but not in the final product. – user3277532 Feb 08 '14 at 03:25
  • I can `open` a bundled JAR without any problem; I don't understand what's not working for you, and I'm not aware of an alternative; you might try on [Ask Different](http://apple.stackexchange.com). – trashgod Feb 08 '14 at 12:49
  • 1
    java -jar your.jar -Xdock:name=Whatever ? – Simone Gianni Oct 11 '18 at 16:49