javawindowsjavafxinstallationjavafx-gradle-plugin

How to set application installer icon in JavaFX?


I'm using the JavaFX-Gradle-plugin to build the distribute-able binaries and the installer of a JavaFX application. When my application runs, I'm able to set the icon this way:

stage.getIcons().add(new Image(this.getClass().getResourceAsStream("/isotype.png")));

which correctly sets the icon for the running application:

enter image description here

as well as the task bar:

enter image description here

But how do I set the icons for the start menu:

enter image description here

and potentially other places:

enter image description here


Solution

  • There is a open pull request documenting this here

    It says:

    Customize Icons

    To customize the icons used in a native bundle, you have to provide the icons for the appropriate bundle. The icons must follow the file name convention in order to get picked up.

    Tip: Set the verbose setting to true, to have log which files are picked up from your deploy directory.

    and for Microsoft Windows in particular:

    Windows

    Icon location: src/main/deploy/windows

    For Windows you can provide two different icons.

    • application icon
    • setup icon - the icon of the installer

    | Type | Filename | | :---------------- |:------------------------- | | .exe icon | \<appName>.ico | | setup exe icon | \<appName>-setup-icon.bmp |

    Despite what it says there, the correct path is src/main/deploy/packages/windows as show in the adjusted-launcher-icon example.