Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
16
rated 0 times [  16] [ 0]  / answers: 1 / hits: 40555  / 3 Years ago, sun, july 4, 2021, 4:29:03

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.)


More From » launcher

 Answers
1

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.


[#26411] Sunday, July 4, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
riffnkful

Total Points: 390
Total Questions: 123
Total Answers: 110

Location: Puerto Rico
Member since Sat, Mar 13, 2021
3 Years ago
;