Generated desktop file for external launcher does not work for non-script targets

Viewed 239

I have an install4j (9.0.5) project for an Eclipse-based RCP application for Windows, macOS and Linux AMD64. My application launchers are generated by Eclipse itself (via Tycho/Maven), and so are native executables in all three platforms. When I use the "create start menu entry" action (or, alternatively, "create program group" with the entry for the launcher), the result in Linux is a .desktop file where the Exec= entry points to the system shell, as follows:

#!/usr/bin/env xdg-open
[Desktop Entry]
Type=Application
Name=MyApp
Exec=/bin/sh "/home/user/MyApp/myRcpLauncher" %U
Icon=/home/user/MyApp/.install4j/i4j_extf_6_1r3k7uj_1suwpj6.png
Categories=Science;

However, since my launcher is not a script, running the resulting menu entry fails silently. I have tried to look for options in the manual, but there does not appear to be a way of telling install4j to use the launcher directly in the Exec= line of the desktop entry file, or to not pass the %U argument which is supposed to represent a list of URLs.

1 Answers

In this answer I note the two obvious workarounds, but I still would like to know if I am missing something myself in the installer actions configuration, or this is missing functionality in install4j.

  • The simplest choice is to manually override the Exec= line with the "Additional desktop file entries" setting of the "create start menu entry" action. However, if the new program folder is not in the PATH, the value needs to manually form the absolute path to the launcher e.g. Exec=${installer:sys.contentDir}/myRcpLauncher.

    This also allows customizing the arguments/placeholders in the line. Note, however, that this option is not available if using the "create program group" action to create several desktop entries at once.

  • Another possibility is to just ship an additional dummy script with the Linux version of my RCP application, set that as the "launcher" w.r.t. install4j, and just forward all arguments to the actual RCP launcher:

    #!/bin/sh
    bdir="$(dirname "$0")"
    exec "${bdir}/myRcpLauncher" "$@"
    
Related