In my environment we have a lot of executable capsule jars which - depending on the environment they connect to - set a custom icon and name programmatically. This is done by calling javax.swing.JFrame.setIconImage and setTitle on startup. We have a centralized dashboard where we can download the executable jars (several 100 different ones), so obviously, I want to be able to download one and run it directly. For this, there are guides all over the internet, and I came up with the normal solution:


[Desktop Entry]
Name=Java Application Launcher
Exec=/usr/bin/java -jar %U

.local/share/applications/mimeapps.list contains:


However, this does not respect the icon as set by the application, there is only the grey questionmark. Even more frustrating, all applications and all opened windows end up in the same spot in the dock, indistinguishable from each other, all named Java Application Launcher.

If I start a downloaded jar from a terminal through java -jar, both the icon as well as it's programmatically set name are visible in the dock, separating different applications from each other.

How can I get the jars to be launchable automatically and also preserve the icon and the name? I cannot create 100s of desktop files as this is not a fixed set of applications.

Running Ubuntu 15.10 / Java 1.8.0_66

1 Answer 1


To get rid of the gray question mark, you add this line of code:

stage.getIcons().add(new Image(getClass().getResourceAsStream("/Images/orca.png")));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.