Wednesday, March 10, 2010

Install IntelliJ IDEA on Linux

Here's a simple way to install IntelliJ IDEA on Ubuntu. I've done this on all Ubuntu Karmic Koala, Lucid Lynx and Maverick Meerkat. This worked just fine on Gentoo Linux too.

1). Install Java (Use Sun JDK. OpenJDK is NOT recommended as the JDK.)
sudo apt-get install sun-java5-jdk
It seems sun-java5-jdk is no longer available now. Refer Oracle Java SE Downloads for Linux and it's installation instructions. Keep the path in your memory; you'll need it when setting up $JDK_HOME path variable.

Then, to make sure that it is installed properly, type
java -version
if the version shows, then it is installed successfully.

2) Now, install IDEA
Download IntelliJ IDEA from the below link
 http://www.jetbrains.com/idea/download/index.html#linux
 Unpack the downloaded archive (ideaIU-9.0.3.tar.gz) by,
     tar xfz ideaIU-9.0.3.tar.gz
(match the file name to your version!)

 Move the extracted archive to /usr/lib
     sudo mv idea-IU-95.429 /usr/lib

3) Configure PATH variables for JDK_HOME and IDEA
     sudo gedit ~/.bashrc
Add following for JDK_HOME to the file, make sure to change the path to reflect your java installation directory.
export JDK_HOME=/usr/lib/jvm/java-6-sun
Append the line for PATH variable with this, /usr/lib/idea-IU-95.429/bin . Finally, it should look like this.
export PATH=$PATH:/usr/lib/idea-IU-95.429/bin
Now, run `source ~/.bashrc` to take effect the changes.

4) Run IDEA  by entering following in the terminal
   idea.sh (or sh idea.sh)

NOTE: If you get permission denied error, then you will have to set the correct permissions to idea.sh file by `sudo chmod 755 /usr/lib/idea-IU-95.429/bin/idea.sh

For easier execution, create a "Custom Application Launcher" at top panel. Access it via; right-click the top Panel -> "Add  to Panel" -> double click "Custom Application Launcher". Browse and give an icon if you like. Then, use a command similar to,
sh /usr/share/idea-IU-95.66/bin/idea.sh


Custom Application Launcher Properties




If you have any problem in setting up this, drop a comment below. Well, even if you got right, just tell me so. Love to hear that too! :). Good Luck!
 

8 comments:

  1. Thanks a lot for this guide, it was clear and really helped.

    ReplyDelete
  2. Welcome Isha, am glad to hear that it helped!

    ReplyDelete
  3. Thanks a lot. Newbie to ubuntu and it helped alot.

    ReplyDelete
  4. how to get JDK_HOME if i installed java erarlier and do not remember where?

    ReplyDelete
    Replies
    1. If you have the `locate` command - `locate java`
      Or you can enter - `which java`. If it returned a path, check whether that's correct. If it's a link then enter the command- ls -al `which java` . These might help you locate the java installation location.

      Delete
  5. "Append the line for PATH variable with this, /usr/lib/idea-IU-95.429/bin "

    There is no PATH in ~/.bashrc

    ReplyDelete
    Replies
    1. It's OK. You can simply add the needed command as it is.

      export PATH=$PATH:/usr/lib/idea-IU-95.429/bin

      Delete
  6. Great tutorial Kasun
    but I keep getting this error:
    JDK Required: 'tools.jar' seems to be not in IDEA classpath.
    Please ensure JAVA_HOME points to JDK rather than JRE.

    and in the .bashrc file i've changed the JAVA_HOME to:

    export JDK_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.91-2.6.2.3.el7.x86_64

    ReplyDelete