0

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?

  • 1
  • I had thought about path, but the application runs without it if I type either form of the one-line command into a terminal, or enter only the part after && while the current directory is the folder the app resides in. Remember: the app runs from terminal, but the very same command line won't run it from a launcher. – Zeiss Ikon Dec 24 '17 at 17:34
  • 1
    the very same command line uses ~ and is a compound command - at the very least you'd need to wrap it in a bash -c '...' shell command, I think - the freedesktop desktop entry standard is pretty restrictive about what's allowed in an Exec key. – steeldriver Dec 24 '17 at 17:40
  • I don' t know how I'd have known this was an Exec key (not having months to read all the docs every time I use a different version of flavor of Ubuntu). More informative error messages would have been a great help here. – Zeiss Ikon Dec 24 '17 at 18:33
2

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:

cd "/home/[user]/Downloads/Wild Card Creator 1-6-2/"
java -jar "libs/Wild Card Creator-1.6.2.jar"

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:

"/home/[user]/Downloads/Wild Card Creator 1-6-2/WildCardCreator.sh"

This now launches the program successfully with a single click (I have my desktop set to launch on single click).

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.