How do I diagnose "There was an error launching the application"?
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.
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]
Version=2.0
Type=Application
Exec=/home/kevin/foo.sh
Terminal=true
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.
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.