JDK-8095033 : Mac OS: stage.getIcons().add(icon) should set the dock icon
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: 8
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2014-01-22
  • Updated: 2015-06-12
  • Resolved: 2014-01-22
Related Reports
Relates :  
Relates :  
Description
I wanted to set the dock icon in Mac and expected it to work the same way as setting the taskbar icon in Windows 7, namely with:

stage.getIcons().add(myIcon).

However, it doesn't work. Instead the default Java coffe cup icon is in the dock.

After googling it turned out, that it can be done with a 3rd party library: com.apple.eawt.Application#setDockIcon

In fact that works, but I'd like to see stage.getIcons().add() work the same way.
Comments
An app on Mac can set its dock icon via: 1. -Xdock:icon command line option. This is not supported in FX yet (RT-12113). 2. An FX API similar to EAWT, which isn't introduced yet (RT-18866). 3. I'm not an expert in Mac packaging, but I believe that if you package your application in a bundle (using the javafx packager tool), you should be able to assign a dock icon for the app via its Info.plist file or some similar way. The option #3 should be working now (again, IIRC). Also, as you notice you can use the legacy EAWT API to achieve the result. So there's a workaround for this issue now. Note that the Stage icons are not supposed to set the icon in the dock, and won't do so on Mac, so I'm closing this issue as Won't Fix.
22-01-2014