TechBrew

Informative geekery on software and technology

How to put IntelliJ IDEA on Ubuntu

November 28th, 2007 by

IntelliJ IDEAI’ve been a user of the excellent IntelliJ Java IDE for 4 years on Windows. Even though the official Linux support by JetBrains is only for RedHat, you can also install IntelliJ fairly easily on Ubuntu. I’ve tested this with Xubunto 7.10 (Gutsy), Java 6, and IntelliJ 7. Here’s how to do it in four basic steps:

1) Get Java

Install the Java 6 JDK, which IDEA itself needs to run. (You can have other JDKs for your projects, but you’ll need this one to run IntelliJ itself.) For example, type this in a terminal:

sudo apt-get install sun-java6-jdk

Follow the prompts for root password, download confirmation, and eventually the Sun EULA to install Java itself. If it installed successfully, you should be able to type this at a prompt:

java -version

… to get several lines telling you the version of Java you have installed. If this doesn’t work, refer to Sun’s documentation on troubleshooting installations.

2) Get IntelliJ IDEA

Download the latest version of IntelliJ IDEA for Linux:

http://www.jetbrains.com/idea/download/index.html#linux

Once the download is finished, extract the archive using the correct filename according to your download. For example, to install IntelliJ in /usr/lib, do the following:

tar xfz idea-7.0.1.tar.gz ./usr/lib/

The IntelliJ installation will now be in a subdirectory indicating the build number, in the format “idea-xxxx”. In the case of IDEA 7.0.1, the app directory is “idea-7364“. (Once the extraction is done, you can delete the downloaded archive to conserve disk space if needed.)

3) Get Environmental

There are a couple of environment variables to be taken care of. First, you need to set a new environment variable that tells IntelliJ where your install of Java is. For example:

export JDK_HOME="/usr/lib/jvm/java-6-sun/"

Use the “env” command, or just “echo $JDK_HOME“, to verify the variable is set.

Next, you’ll need to edit /etc/environment with superuser rights in the editor of your choice, adding the idea-xxxx/bin directory to your PATH variable. For example, you can edit the environment with the GUI mousepad editor like so:

sudo mousepad /etc/environment

The various directories in the environment PATH variable are delineated by colons (:). Append the current value (inside the quotes) with a new colon and then add the idea-xxxx/bin location. It should look something like this:

PATH="/usr/local/sbin:/usr/local/bin:/usr/lib/idea-7364/bin"

Save and close the environment file. You’ll need to “source” it for your system to pick up the new directory in the PATH. You can verify your changes by echoing the variable as well:

source /etc/environment
echo $PATH

If you see the path to IntelliJ returned in the output, you’re all set.

Lastly, you may want to change the VM settings of IntelliJ. This depends entirely on your project size and other factors, so you’ll need to base these settings on your own need. The settings are in idea-xxx/bin/idea.vmoptions.

4) Get Started!

That’s it. Now you can run “idea.sh” from a terminal in any directory, and IntelliJ should launch…

idea.sh

If you run into problems, be sure to double-check the readme files in the installation directory.

Give Back

If this article proved useful to you, please drop us a comment and let us know. Or, if you find problems/alternate solutions along the way, please share them for the benefit of others. Thanks and happy coding!

Trackback URI | Tags: How-To

32 responses so far ↓

  • 1 David robles // Dec 11, 2007 at 11:19 am

    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??

  • 2 Mark Woodman // Dec 11, 2007 at 1:22 pm

    David,

    Add an ampersand (&) to the end of your command (“idea.sh &”) to run it as a background process.

    For more info on foreground/background processes in unix, here is a helpful page.

    - Mark

  • 3 David robles // Dec 11, 2007 at 2:19 pm

    Thanks, now it’s working the way I wanted.

    Thanks again.

  • 4 G // Jan 7, 2008 at 2:24 pm

    Thanks for the tutorial.
    I’m running Ubuntu 7.10, Java 6 and Idea 7.0.2 and Idea complained about a JAVA_HOME environment variable as well.

    So my addition to this tutorial would be to:
    Add the following lines to your ~/.bashrc
    export JDK_HOME=”/usr/lib/jvm/java-6-sun/”
    export JAVA_HOME=”/usr/lib/jvm/java-6-sun/”
    ~

    and then run
    source ~/.bashrc
    to apply those two variables.

    Worked for me at least.

  • 5 Michael Vogt // Jan 31, 2008 at 1:07 pm

    Hi.

    Worked perfectly. Thanks for this article.

    But, isn’t there any other way available to start intellij than from the terminal? (Yup, linux noop here).

    Thanks,
    Michael

  • 6 Mark Woodman // Feb 1, 2008 at 10:31 am

    You can create a desktop shortcut if you like. How to do it depends on your desktop environment.

    Here’s a forum thread that discusses a couple of ways:
    http://ubuntuforums.org/showthread.php?t=360263

  • 7 Michael Vogt // Feb 2, 2008 at 3:01 am

    Hello Mark.

    Thanks for your answer. Seems the problem I had a comletely different problem. The export of $JDK_HOME was not persisted. I had to add the path to the environment file. Now all works as expected.

    Thanks,
    Michael

  • 8 albemuth // Feb 11, 2008 at 10:59 pm

    I followed David’s post but my jvm was in a different location, to find it I used

    find / | grep jvm

    then I set both variables to /usr/lib/jvm/java-6-sun-1.6.0.03/

  • 9 Jonathan Moore // Mar 19, 2008 at 12:22 pm

    You should set the path as

    export PATH=$PATH:new_stuff

    so you don’t remove othere things added

  • 10 Benito // Apr 10, 2008 at 5:26 am

    you could write a launch script and create a menu item pointing to it, e.g.

    launch.sh

    export JDK_HOME=[whatever]
    export JAVA_HOME=[whatever]
    /home/benito/idea702/bin/idea.sh

    make it exectable
    chmod +x launch.sh

    then just point the menu editor to it, it even has some icons for you to choose from in the bin directory.

  • 11 Phil W-S // Apr 23, 2008 at 6:52 am

    If you want a really lightweight “launcher” for your launch panel (or a menu) you can set one up with the following command set in it:

    /bin/sh -c “export JDK_HOME=[whatever] && /[idea install path]/bin/idea.sh”

  • 12 mauro // Jul 4, 2008 at 5:23 am

    Hi. Thanks for your post, I find it very usefull.
    I have a problem running idea.. I start it and everything seems to be ok but I can’t see the content of the main window!!
    I’m new on Linux, hope you could help me.
    thanks in advance.

    mauro

  • 13 mauro // Jul 4, 2008 at 6:06 am

    OK! I’ve get it.. It was the Nvidia drivers.
    Thanks! :)

  • 14 Gino // Nov 20, 2008 at 4:46 pm

    Hi,
    why if i use idea.sh from the menu don’t work and from terminal yes???

    I don’t understand this command
    /bin/sh -c “export JDK_HOME=[whatever] && /[idea install path]/bin/idea.sh”

    thanks at all

  • 15 Chris // Apr 2, 2009 at 4:45 pm

    Thanks! This was really useful!

  • 16 Ginux // Apr 10, 2009 at 5:23 pm

    Hi guys
    In linux mint this command doesn’t work
    /bin/sh -c “export JDK_HOME=[whatever] && /[idea install path]/bin/idea.sh”

    i can run intellij idea by terminal using
    sh [idea install path]/bin/idea.sh

    please help me

    thanks a lot

  • 17 Kaan Yy // May 12, 2009 at 2:25 am

    You can also add a shortcut to menu. (right click to applications and select edit menu)

    However idea 8.1.1 and Ubuntu 9.06 (jdk 6u13), i can not browse source folders. Java files are not visible most times…

  • 18 IntelliJ in Ubuntu installieren « Christian Kettner – CK3 | who cares? // Nov 10, 2009 at 1:49 pm

    [...] diversen Rechnern mit Ubuntu installiert. Und jedes Mal habe ich die wirklich sehr gute Anleitung How to put IntelliJ IDEA on Ubuntu von techbrew verwendet. Um das jetzt endlich mal zu würdigen, und die Anleitung keinesfalls [...]

  • 19 Dushan // Dec 16, 2009 at 12:07 pm

    Doesn’t work on my ubuntu 9. 10 please help me

  • 20 IntelliJ IDEA on Ubuntu | NiftyEye Blog // Mar 17, 2010 at 12:25 pm

    [...] SOURCE SHARETHIS.addEntry({ title: "IntelliJ IDEA on Ubuntu", url: "http://www.niftyeyeblog.com/intellij-idea-on-ubuntu/" }); [...]

  • 21 Osik // Mar 22, 2010 at 2:31 pm

    Thanks a lot! =)
    it really works!

  • 22 Andy Whitten // Mar 26, 2010 at 8:06 am

    hey thanks for your information sharing but have 1 question that how should i run the C language file in Ubuntu. Is it any way or its not going to work

  • 23 Jasintha Dasanayaka // Mar 27, 2010 at 12:39 pm

    Add Idea to Ubuntu Menu
    Follow this is better
    First make a soft link of ideaXXX/bin/luncher.sh /user/bin/luncher.sh
    now go to system—>preference—>menu
    then add menu give the command as follows
    /usr/bin/luncher.sh

  • 24 Saros // Dec 21, 2010 at 4:57 pm

    very helpful, thank you

  • 25 Srividhya // Feb 15, 2011 at 2:35 pm

    Hi, I was trying to follow these steps and I get a weird error message “tools.jar is not in idea classpath. please ensure java_home points to jdk rather than jre”.

    Can anyone help me through it?

    Thanks.

  • 26 Mark // Feb 15, 2011 at 2:42 pm

    Srividhya,

    Do ‘java -version’ and you’ll see that your environment is pointing at a JRE directory instead of a full JDK.

    See http://wwww.ubuntuforums.org/showthread.php?t=959556

  • 27 Hiren // Mar 21, 2011 at 1:22 am

    Very useful article, thanks you so much

  • 28 Instalace IntelliJ IDEA 10 pod Kubuntu | PetrMiko.cz // Apr 2, 2011 at 3:40 am

    [...] rozbalení balík p?esu?te kam se vám zlíbí, já volil dle návodu zde složbu /usr/lib. sudo mv idea-package-folder [...]

  • 29 Christian // Jun 13, 2011 at 10:59 am

    Used it again! Thx…

  • 30 Russell John-Baptiste // Jan 28, 2012 at 12:05 pm

    Great tut!

    Thanks!

  • 31 Markus // May 1, 2012 at 3:34 am

    Obsolete with ubuntu 12.04

    Have to install sun jdk manually, why bother, open jdk works nicely with intelliJ

  • 32 Affiliate Marketing eBook // Dec 2, 2013 at 6:29 pm

    Aw, this was a very good post. Finding the time and actual effort to produce a very good article? but what can I say? I hesitate a lot and don’t seem to get nearly anything done.

Leave a Comment