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?


2 Answers 2


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.

  • That was the issue. Once I added an appropriate reference for the JAVA_HOME variable to the ~/kde/env/ directory (its ~/kde, not ~/kde4 on my system for some reason), I could start the program appropriately. Great answer, Thanks @ephemient. Apr 14, 2012 at 15:10
  • @HariSeldon KDE's default is to use kde, but some distributions changed it to kde4 to allow parallel installability between KDE3 and KDE4. I wasn't sure what you were running.
    – ephemient
    Apr 14, 2012 at 15:21

I have a simple workaround that involves a 2 line script. It simply re-exports the $JAVA_HOME variable to the appropriate path, and then invokes the application's main shell script. Repointing the KDE Application Launcher to this new script launches the application as expected.

I'm still not sure why I need to do this though, since I can plainly see the correct $JAVA_HOME variable definition outside of the context of my contrived script. So if anyone can shed light on why that might be occurring, I would happily mark that as the appropriate answer for this question.

  • Good diagnosing - I tend to set up environment in /etc/environment which is loaded by pam_env.so regardless of how I log in, so I might not have thought of this.
    – ephemient
    Apr 14, 2012 at 5:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .