Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I did the following procedures to create a application launcher but it doesn't work.

  1. create shell script named with the following content:

    java -jar foo.jar
  2. Added execution permission: sudo chmod +x
  3. Created .desktop file in /usr/share/applications/ with the content:

    [Desktop Entry]

Then I have an application with icon, but it couldn't run, while double click works. What's wrong?

share|improve this question
up vote 3 down vote accepted

Here are some tips that can help you solve your problem:

  1. Replace Exec=/path/ with Exec=sh /path/ or Exec=bash /path/
  2. Add execution permission to the .desktop file

    sudo chmod +x /usr/share/application/<your_desktop_file>

Also unless you want that launcher to be available system-wide (ie: to all users) you can place the .desktop file in ~/.local/share/applications. As that folder is located in your home folder you don't need sudo to create/edit the file.

share|improve this answer
Thanks. I've tried but the problem remains. Maybe jar file couldn't be executed with desktop application launcher? – iceboal Dec 18 '12 at 22:02
What happens if you replace Exec with Exec="java -jar /full/path/to/foo.jar"? – Salem Dec 18 '12 at 23:45
I used Exec = java -jar /path/foo.jar and it work. Thanks! So what's wrong with the shell script? – iceboal Dec 19 '12 at 9:58
You should have some problem in the path used in Exec. I created a similar setup and if the .desktop and the .sh files are both executable it works. Check if you have spaces or some special characters in the path that should be escaped. – Salem Dec 19 '12 at 13:22

I don't know what's wrong with your entry, but I use the following app to create custom launchers. works in Unity too:

Desktop Entry Editor is a GUI application for editing and creating application launchers for GNOME, KDE, XFCE, and any other desktop environment implementing the Desktop Entry Specification from

share|improve this answer

Be sure to check that you either

  1. use full paths in your shell file, e.g., in java -jar you need to replace with /full/path/to/
  2. set the Path property of the desktop entry, which defines the working directory for your script, i.e., the script executes relative to the specified working directory.

If you follow the second option your desktop entry will look something like this

[Desktop Entry]
share|improve this answer
This did it for me, primarily you need the Path set – thouliha Jun 14 '15 at 3:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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