I created a my-app.desktop file for a program I wrote. When I double-click it, I get the error message "There was an error launching the application". How can I get more detailed information about what the problem is?

I saw a reference to a "details" section of the dialog box, but there is nothing like that present in the one I see. If I were on my Mac, I'd open the Console app to see if any errors were logged, but I haven't learned of anything similar on Ubuntu.

(Note that unlike other similarly-titled questions, I am not asking what's wrong with this particular .desktop file; I want to know how to find out in general.)

  • 1
    I would just run the Exec line from the terminal and see what the output tells you, but are you sure the desktop file is ok? maybe you should check and run it from the terminal as well. – Jacob Vlijm Mar 20 '14 at 17:51
  • @Jacob If there is a way to "run it from the terminal" that puts something useful on stderr, that would constitute an answer to this question. – Kevin Reid Mar 20 '14 at 17:56
  • 1
    @terdon I tried that, and it turned out that (as the next problem) the environment was different in a way that mattered. I want to know how to get more information out of the normal launch process so that I'm not guessing at what's different. – Kevin Reid Mar 20 '14 at 18:25
  • 2
    @terdon Empirically, running it in the terminal is different — I tried and it was different (in particular a different PATH). I want to know how to get exactly the same environment as a normal launch but with more diagnostic info. – Kevin Reid Mar 20 '14 at 18:38
  • 2
    A bit offtopic, but 9 times of 10 that problem airs it is special characters, like spaces, in Exec= path. Remember, you should have Exec= in quotes and Path= without quotes. – Barafu Albino Sep 24 '16 at 14:06

Here's a trick you can use. Create a wrapper script for your application that will launch it and capture the error output:

#!/usr/bin/env bash

## Launch 'yourapp' and capture its standard error output
/path/to/yourapp 2>~/myapp.log

Save that as ~/foo.sh and make it executable with chmod +x ~/foo.sh. Now, point your desktop launcher to it instead. Something like:

[Desktop Entry]
Comment=My app!

That will redirect any error messages to ~/myapp.log and you can examine them at your leisure. You can use 2>>~/myapp.log if you want successive error messages to be appended to the file instead of overwriting it.

As an aside, the reason that the $PATH is different is because you are probably setting your $PATH in ~/.bahsrc which is not read by the graphical environment. It is also a bad idea since the $PATH will be set every time you open a new terminal and that is needless overhead. Use ~/.profile for this instead. For more details on which files are read when see here and for more on which file should be used for what, see here.

  • Didn't found the problem this way, but the wrapper was working, so I just kept the wrapper as the executable. – Jānis Elmeris Jan 29 '18 at 18:49

Found an answer to this question here: https://askubuntu.com/a/836842

Try this :

desktop-file-validate my-app.desktop

It outputs errors in your .desktop file. For example mine returned :

error: first group is not "Desktrop Entry"

So once I corrected the typo to Desktop Entry, the script ran successfully.


By running the following command in terminal:

awk -F= '/Exec=/{system($2)}' your_desktop_file.desktop

I am sure that you will find out if there is an error or not in your command assigned to the Exec field from inside of your .desktop file.

  • 5
    I've a similar problem. i execute your command and my.desktop file work perfectly. But when i double click it ,it shows There was an error launching the application – Sayantan Koley Jul 10 '16 at 19:02
  • This answer is kind of funny, since (even though I don't think it does any-much-more than running Exec value in the shell) it made me realize TryExec key was my problem. – mirh Dec 4 '18 at 23:13

usually, the terminal(-output) gives you a lot of useful information, both on the application as well as the desktop file. An example: if I run my application from the terminal, typing the command in the terminal, the application starts.

However, if there is something wrong, you can expect an output like:

Traceback (most recent call last):
  File "/home/jacob/Bureaublad/werkmap_2.0/uploaded_versions/2.1.2/32_en_ppa    /qle-2.1.2/code/qle_quicklisteditor", line 4044, in <module>
  File "/home/jacob/Bureaublad/werkmap_2.0/uploaded_versions/2.1.2/32_en_ppa   /qle-2.1.2/code/qle_quicklisteditor", line 51, in __init__
AttributeError: 'MainWindow' object has no attribute 'load_sectons'
jacob@Jacobwerkkamer:~/Bureaublad/werkmap_2.0/uploaded_versions/2.1.2/32_en_ppa   /qle-2.1.2/code$ 

which gives you a lot of usefull information, even the line in your application that causes the error. (I messed it up on purpose)

The same with the desktop file, just open a terminal in the directory of the .desktop file and drag it on to the terminal. If you for example remove the Exec= line from a .desktop file, the terminal will tell you it cannot find the command to execute.

To test if the application gives an error, just run what you put after theExec= string.

The terminal output is usually very specific and useful in bug reports, like here.

  • 2
    I know about how to use a terminal and how to troubleshoot a program launch in general. Assuming this approach, what I need to know is how to reproduce the conditions of a .desktop launch accurately in the terminal. – Kevin Reid Mar 20 '14 at 18:41

This might help other people - this is the official spec of the desktop launcher files

The important section is : Recognized desktop entry keys - which shows you which values you need.


When I really can't figure it out, I:

cd ~/Desktop
ln -s /my/binary/thatIwanttorun mybinary

Then right click on the default icon that's created and point to a better graphic.

  • and there should be a <cr> after "cd ~/Desktop" – Tom Feb 9 at 21:21

For me, the problem was a missing Icon= line (which seems like a stupid requirement for a working launcher). My full .desktop file now looks like:

[Desktop Entry]
Comment=Variant of Eclipse

Which isn't particularly robust to changes in user, but whatever.

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.