Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

  1. create shell script named shell.sh with the following content:

    java -jar foo.jar
  2. Added execution permission: sudo chmod +x shell.sh
  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 shell.sh works. What's wrong?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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

  1. Replace Exec=/path/shell.sh with Exec=sh /path/shell.sh or Exec=bash /path/shell.sh
  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 freedesktop.org.

share|improve this answer

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.