41

Is there any scripts for downloading and installing IntelliJ with JavaJDK or OpenJDK?

I don't know how I did it before using Ubuntu 12.10 but I'm now on a fresh 13.04 install and I have been looking around for an all in one script, or some scripts I can cobble together

I have the two links detailed that I think will be handy, can anyone else add to this please?

How do I install Oracle Java JDK 7?

Install Oracle Java 7 in Ubuntu via PPA Repository

Update: I have now found you can install IntelliJ through the Ubuntu software centre, so although this was a nice learning exercise for me it's not really relevant any more. Thanks to everyone that contributed.

5
  • Why do you want a script for that? It's not too complicated to do it manually. Just follow the instrucation from the links you posted and download and unzip IntelliJ. Shouldn't take you more than five minutes (plus download time). Mar 25, 2013 at 16:40
  • I want a script so I can save myself five minutes ;) and also learn something in the process
    – spences10
    Mar 25, 2013 at 16:42
  • If you want to learn something write the script yourself ;-) I doubt that there is a something like this out there as it is very specific. Mar 25, 2013 at 16:54
  • Are there any examples? I knew this would happen, go to ask a perfectly legitimate question and get flamed in the comments
    – spences10
    Mar 25, 2013 at 17:06
  • My intention wasn't to flame you. Sorry if that came out wrong. Mar 25, 2013 at 17:12

6 Answers 6

78

Installing JDK

To install JDK, you can refer to help.ubuntu.com/community/Java.

If you want to install openJDK,

sudo apt-get install openjdk-7-jdk 

If you want to install Oracle JDK, you can use PPA from webup8 team.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

Installing IntelliJ IDEA

[Updated Answer]

Download IntelliJ IDEA CE from www.jetbrains.com/idea/download/.

  1. Extract ideaIC-XX.Y.Z.tar.gz using

    tar -zxvf ideaIC-XX.Y.Z.tar.gz
    
  2. Run idea.sh in bin directory inside the extracted folder.

  3. To create command-line runner, Tools > Create Command-line Launcher
  4. To create a desktop entry, Tools > Create Desktop Entry

That's it. Now, you can launch IntelliJ from Ubuntu dash.

[Old Answer]

Download IntelliJ IDEA CE from www.jetbrains.com/idea/download/.

  1. Extract ideaIC-XX.Y.Z.tar.gz using

    tar -zxvf ideaIC-XX.Y.Z.tar.gz
    
  2. Become root.

    sudo -i
    
  3. Move the extracted folder to /opt/idea

    mv ideaIC-XX.Y.Z /opt/idea
    
  4. Create a desktop file and install it:

    gedit idea.desktop
    

    and copy the following to the idea.desktop file.

    [Desktop Entry]
    Name=IntelliJ IDEA 
    Type=Application
    Exec=idea.sh
    Terminal=false
    Icon=idea
    Comment=Integrated Development Environment
    NoDisplay=false
    Categories=Development;IDE;
    Name[en]=IntelliJ IDEA
    

    then execute the following command to automatically install it in the unity:

    desktop-file-install idea.desktop
    
  5. Create a symlink in /usr/local/bin using

    cd /usr/local/bin
    ln -s /opt/idea/bin/idea.sh
    
  6. For idea icon to be displayed in dash, idea icon can be added as

    cp /opt/idea/bin/idea.png /usr/share/pixmaps/idea.png
    

That's it. Now, you can launch IntelliJ from Ubuntu dash.

5
  • thank you. Of all the guides out there, this one worked the best for me. Mar 1, 2014 at 13:42
  • Exactly. This answer gives the best usable result! Kudos! :) Jun 5, 2014 at 12:44
  • 1
    You can skip step four and do it at the end once intellij is running by going to Tools > Create Desktop Entry. Much easier.
    – mlissner
    Apr 28, 2015 at 22:20
  • @mlissner Thanks. I updated my answer finally. Apr 29, 2015 at 22:03
  • Steps 1-3 can be replaced with Ubuntu make (which should update automatically, etc). See askubuntu.com/a/659689/438156
    – serv-inc
    Aug 10, 2015 at 9:28
29

This should get you started:

#!/bin/sh

add-apt-repository ppa:webupd8team/java &&
apt-get update &&
apt-get install oracle-java7-installer &&
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections &&
update-java-alternatives -s java-7-oracle &&

wget -O /tmp/intellij.tar.gz http://download.jetbrains.com/idea/ideaIC-12.0.4.tar.gz &&
tar xfz /tmp/intellij.tar.gz &&
cd idea-IC-123.169/bin &&
./idea.sh

Some things you should consider:

  • I'm not sure at which part the echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections has to be. Might be a line earlier.
  • The line cd idea-IC-123.169/bin is dependend on the IntelliJ version, as the extracted folder is named in that way. It only works with the version available while I'm writing this.
  • Same goes for the download link. It might change with a newer version.
  • I'm not sure what happens if you try to add a ppa that already exists again. This could lead to problems.
  • You have to execute the script as root
4
  • Excellent thanks, so wget -O is that what you can use to download any file from a url?
    – spences10
    Mar 25, 2013 at 17:16
  • Yes, the -O option specifies the output file. If you omitt it, the file is saved in the current directory with the name as it is downloaded. Mar 25, 2013 at 17:19
  • See askubuntu.com/a/659689/438156 for an automatic way using Ubuntu Make. (that keeps the idea package updated etc)
    – serv-inc
    Aug 10, 2015 at 9:29
  • worth mentioning you can use a regex when cd into the extracted folder: cd idea*/bin should work
    – aholt
    Jun 3, 2016 at 14:08
17

New way: you can use Ubuntu Make. To install on 16.04 (Xenial) [and later]

sudo apt install ubuntu-make

If your Ubuntu version if before 16.04 (codename Xenial), you can install from the Ubuntu Make PPA. First, add the PPA to your system:

sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-make  
sudo apt-get update

Then, installing Ubuntu Make:

sudo apt-get install ubuntu-make

After installing Ubuntu Make, do a

umake ide idea
0
2

You can also try my ubuntu repository: https://launchpad.net/~mmk2410/+archive/ubuntu/intellij-idea-community

To use it just run the following commands:

sudo apt-add-repository ppa:mmk2410/intellij-idea-community
sudo apt-get update
sudo apt-get install intellij-idea-community
1

I kept installing various JB tools on a bunch of machines, so finally wrote a tiny tool to help with that, check it out here: https://github.com/MarcinZukowski/jetbrains-installer

It's also useful when JetBrains releases a new version requiring manual download, allows automating that.

0

Installing JDK

Oracle JDK

sudo add-apt-repository ppa:webupd8team/java`
sudo apt-get update
sudo apt-get install oracle-java7-installer

OpenJDK

sudo apt-get install openjdk-8-jdk

You can also install openjdk 9, 10 or 11 this is as per your choice; just replace 8 with version number to install another version.

Installing Intellij

Installing intellij from snap store

sudo snap install intellij-idea-ultimate --classic --edge

This is a ulimate edition so you need activation code in order to activate it.

sudo snap install intellij-idea-community --classic

This is community version so don't need activation code; but it has limited features and tools.

Happy Coding :)

You must log in to answer this question.

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