2010/02/21

IntelliJ Idea Menu Item on Ubuntu Desktop

Creating a Menu Item for IntelliJ Idea (and I'm guessing any other Java GUI app) is pretty annoying on Ubuntu Desktop. As it turns out the annoyance is caused because your environment variables defined in .bashrc are not available when executing commands defined in the Menu Editor. To fix this you need to explicitly define the JDK_HOME variable before calling the idea.sh script.

The steps are;
  1. Navigate to System > Preferences -> Main Menu
  2. Locate "Programming" under the "Menus" panel
  3. Click the "New Item" button
  4. Enter the appropriate details;
    Type
    Application
    Name
    IntelliJ Idea
    Command
    bash -c "export JDK_HOME=/usr/lib/jvm/java-6-sun; ~/Development/Tools/Idea/current/bin/idea.sh"
Obviously you'll have to substitute the paths you are using for both Java and Idea...

I rarely use the Menu but by adding Idea to the menu GnomeDo automatically picks it up.