Skip to content

Instantly share code, notes, and snippets.

@sargunv
Created May 14, 2019 07:04
Show Gist options
  • Save sargunv/2389cdff9d684496eb88b0af113c18d1 to your computer and use it in GitHub Desktop.
Save sargunv/2389cdff9d684496eb88b0af113c18d1 to your computer and use it in GitHub Desktop.

I've found a bug in the jpackage tool early access which I obtained from https://jdk.java.net/jpackage/. The issue is that the icon path is incorrect in the generated desktop entry file.

Steps to reproduce the bug in Ubuntu are as follows:

I have a project in which I create an app image with the command:

jpackage create-app-image --output build/jpackage --name modsman-gui --module-path build/jlinkbase/jlinkjars --module modsman.gui/modsman.gui.MainKt --runtime-image build/image --icon icons/linux.png  

This creates an app image and puts the icon inside the resources directory.

I then create a deb installer for that package with the command:

jpackage create-installer --installer-type deb --output build/jpackage --name modsman-gui --app-image build/jpackage/modsman-gui --app-version 0.0.0 --linux-bundle-name modsman-gui  

When I install the resulting deb package, there's a desktop entry installed called modsman-gui.desktop. That file has the following content:

[Desktop Entry]  
Name=modsman-gui  
Comment=modsman-gui  
Exec=/opt/modsman-gui/modsman-gui  
Icon=/opt/modsman-gui/modsman-gui.png  
Terminal=false  
Type=Application  
Categories=Unknown

That Icon property points to a path containing the default gray application icon, not the icon I specified when creating the app image. In order to set the icon properly, the Icon property must be set to:

Icon=/opt/modsman-gui/resources/modsman-gui.png  

This is because the create-app-image command put the icon inside the resources subdirectory. So, this is either a bug in create-installer pointing the desktop entry to the wrong icon, or a bug in create-app-image placing the icon in the wrong place.

You can reproduce it yourself by cloning my git repo from https://gitlab.com/sargunv-mc-mods/modsman-new and running ./gradlew :modsman-gui:jpackage. Inspect the deb package created in modsman-gui/build/jpackage, and you'll find the issue described above.

Reproduced on jpackage version 13-internal downloaded on May 13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment