IntelliJ IDEA Ubuntu Launcher

IntelliJ IDEA Ubuntu Launcher

IntelliJ IDEA is very easy to install: download and unzip, can’t be simpler.

However creating a launcher for it is not that straightforward, whether it is a Gnome / KDE keyboard shortcut, desktop launcher, docking launcher ( e.g. avant window navigator ) or a simple “Alt+F1″ menu item.

But it is Ubuntu after all: the virtual land of unlimited possibilities.

Here is a simple launcher script that will do the trick:

#!/bin/bash
 
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export JDK_HOME=/usr/lib/jvm/java-6-sun
 
export IDEA_HOME=/opt/idea-IU-95.66
 
export IDEA_VM_OPTIONS="$IDEA_HOME/bin/idea.vmoptions"
export IDEA_PROPERTIES="$IDEA_HOME/bin/idea.properties"
 
cd "$IDEA_HOME/bin"
export LIBXCB_ALLOW_SLOPPY_LOCK=1
 
./idea.sh

A couple of things to note:

1. Point JAVA_HOME and JAVA_JDK to the place where you have JDK installed
2. Point IDEA_HOME where you have IntelliJ IDEA installed
3. Make this script executable e.g. chmod +x idea-launcher.sh [ given that you name it "idea-launcher.sh", of course ]

Now you are free to create any kind of launcher that suites your needs pointing it to this script.

8 comments

  1. i tried to do what is told above but now i get

    cannot open /bin/idea.vmoptions: No such file
    this error when i write ./idea.sh in Terminal how can i fix that

  2. @Kivanc,

    You need to set your “$IDEA_HOME” variable. In the above example IDEA is installed under “/opt/idea-IU-95.66″:

        export IDEA_HOME=/opt/idea-IU-95.66

    then you need to export “$VM_OPTIONS” variable referencing $IDEA_HOME:

        export IDEA_VM_OPTIONS="$IDEA_HOME/bin/idea.vmoptions"

    All these variables are exported in the article’s example, just substitute your settings for “IDEA_HOME” and Java variables.

    “cannot open /bin/idea.vmoptions: No such file”, means that your $IDEA_HOME is not set.

    /Toly

  3. Great tip! worked as expected.

  4. Thanks for the script! Worked like a charm, saved be a bunch of time.

  5. Thanks for this script, very useful.
    Can you explain me the what the export LIBXCB_ALLOW_SLOPPY_LOCK=1 is for?

  6. @Robin,

    Welcome. I just ran it in debug to get the actual locking problem, and saw:

    xcb_xlib.c:82: xcb_xlib_unlock: Assertion 'c->xlib.lock' failed

    It seems that when a Java Swing based app places a hard lock on an Xorg resource it has problems unlocking it. I have not looked at “xcb_xlib.c” to see the reason, instead I enabled a sloppy lock: ‘LIBXCB_ALLOW_SLOPPY_LOCK = 1′, which was a googled guess, but it worked :)

    /Toly

  7. Thank your for the post, it helped me a lot! But just one more question..
    I’m running Intellij from the terminal as you mentioned in the post, but if I close the terminal it closes Intellij as well, is there any way of keep it running without having the terminal window open??

  8. @Shane,

    I have it configured as a Compiz “Command Shortcut” that just starts/executes this script without running a terminal at all.

    But you can always start it from your terminal with a nohup.

    /Toly

tell me something...
  1. (required)
  2. (valid email - optional)
  3. Captcha
  4. (required)