Ubuntu – Setup and install IntelliJ with JDK

javajdkopenjdkoraclesoftware installation

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.

Best Answer

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