I'm using Ubuntu Mate 16.04.3. I've installed a Java application that launches correctly from the command line with cd "~/Downloads/Wild Card Creator 1-6-2/" && "./WildCardCreator.sh"
-- and that's good.
However, I'd like to be able to launch this application with a click or two, so I'm trying to create a Mate launcher. I go through the process, pasting the command line above into the launcher's "Command" field, filling in the "name" and "Comment" fields appropriately, setting the icon with an image provided in the application tarball, ensuring that the pull-down is set to "Application" -- and when I click the launcher, I get nothing (if I created it in the Main Menu) or a message box that just says "There was an error launching the application." (if I created it on the desktop). If I set the launcher as "Application in Terminal" I get exactly the same result -- no terminal opens, but I get the same error.
Even if I copy the command java -jar "libs/Wild Card Creator-1.6.2.jar"
from WildCardCreator.sh into the command line of my launcher after the cd
command, I get the same uninformative error -- but that, also works properly if I paste it into a terminal.
It seems like this should be simple -- a launcher ought to reasonably be able to run any command I can run by typing it in a terminal. What am I doing wrong?
I found a solution to this.
First, I altered the (one-line) file I was launching. I added the
cd
command needed to ensure the .jar file was executed in its own folder to that file, rather than trying to put it in the launcher's command field. This gave the following as the file I was launching:After verifying that this would still run the target program when launched from a terminal, I was able to simplify the launcher, eliminating the compound command. I found I still had to manually expand the
~
, however, so I wound up with the actual launcher command being:This now launches the program successfully with a single click (I have my desktop set to launch on single click).