Ubuntu · Installing Oracle's Java 7

Ubuntu · Installing Oracle's Java 7

in

Note: This was tested on 12.04, but should work for later versions as well.

Add the repository so that you have somewhere to pull JDK 7 from

sudo add-apt-repository ppa:webupd8team/java

Update your machine’s information about available software

sudo apt-get update

Finally install Java

sudo apt-get install oracle-java7-installer

Of course, if you need Java 6, Java 8, etc, just change the number in that last command. You can restart your machine if you want, but usually it’s not necessary.

To test if it’s working, run this command:

java -version

To see if compiling would work, run:

javac -version