kde – Registering a Standalone App in the Application Launcher of KDE

applicationdesktop-environmentkde

First off, I am using Kubuntu 12.04.

I've just downloaded and unpacked a standalone installation of some software (Intellij's Phpstorm IDE, but I don't think it matters). I've copied the unpacked directory to my /opt directory using sudo.

I am able to launch the main shell script from the commandline without using sudo with no issues.


I would like to run the app from my Application Launcher so, I ran the Edit Applications... app from the Launcher icon and added the path to the main shell script in a new entry (/opt/PhpStorm-111.344/bin/phpstorm.sh) and saved it. Whenever I click the newly added entry, nothing happens, the application does not launch. I have seen this question about registering applications in kde, and I don't think it applies to this situation since that is what the Edit Applications... dialog is supposed to do (I think).

So what am I missing? Do I need to specify another way of running the command in the dialog entry? Is this a .desktop file issue? Something else?

I ran the command /opt/PhpStorm-111.344/bin/phpstorm.sh from the ALT+F2 run box , invoking a terminal. I was returned with a message complaining that the $JAVA_HOME variable cannot be found.

Now, I do indeed have a $JAVA_HOME environment variable setup in my .bashrc file, and it can be seen from an echo $JAVA_HOME command. Again, I am able to run the application with no problems if I simply open a terminal and run the shell script from there, so the $JAVA_HOME variable is seen in that context. I have logged out and back in and run source ~/.bashrc, and neither seem to help.

I am thinking now it is some sort of user permission issue to the $JAVA_HOME variable that is preventing it from running.

Any suggestions?

Best Answer

Depending on how your display/xsession manager is set up, ~/.bashrc may not be sourced before startkde is called, so if that's where you're setting up $JAVA_HOME, nothing on your KDE desktop may see it.

Helpfully, startkde is set up to source *.sh from every directory in kde4-config --path lib | tr : '\n' | sed -n -e 's,/lib[^/]*/,/env/,p'. This likely contains ~/.kde4/env or similar, so if you want a variable to be present KDE-sessionwide, just drop a shell script with an export in there.

Related Question