2

I am developing a JavaFX 8 application that runs cross-platform on Windows/OSX/Ubuntu via JWrapper. Right now I am using stage.getIcons().add(..) to set the stage icon to a 256x256 PNG bundled with the application. This works on Windows, however on Ubuntu, the dock icon remains the Oracle/Java default icon, as shown below. Is there some third party library, or some technique I can use to get my own icon and tooltip/title to display for the Ubuntu dock icon?

enter image description here

Jan Doggen
  • 8,799
  • 13
  • 70
  • 144
Sam Johnson
  • 624
  • 1
  • 7
  • 20

2 Answers2

4

Ubuntu is a bit different: You would need to set the icon within a .desktop file. As far as I recall from our Ant-based build script using the JDKs javapackager tool, it is able to do that for you, but this bundles the whole JRE with it as well and you would need access to a (virtual) machine for each target platform and architecture (there are no Delta packages like in Eclipse, unfortunatly).

So basically when you export your application, you should build a predefined .desktop file, which would specify both the exec command and the path to the icon (whre I don't know, if this needs to be absolute or relative to the .desktop file location).

dzim
  • 1,131
  • 2
  • 12
  • 28
  • This fixes my issue -- I'll simply make sure that when my app is run, it is done so from a .desktop file that has the proper icons set. Thanks! – Sam Johnson Mar 31 '16 at 19:05
  • I'm in a similar situation with a bundled JRE using JWrapper – Sam Johnson Mar 31 '16 at 19:06
  • You're welcome. You just need to know, that you could specify a command like "java [more-parameter] -jar " in the exec part of the .desktop file, as well. There is no real need for a bundled JRE - from the .desktop file perspective. – dzim Apr 01 '16 at 06:34
1

An issue was raised against openjdk https://bugs.openjdk.java.net/browse/JDK-8204936

Posting it here so that other will know the status

Ashok Koyi
  • 5,327
  • 8
  • 41
  • 50