How to install Oracle Java 7 on Ubuntu and Mint Linux

There are several different ways, this one is simple and has worked flawlessly for me many times, so I hope it can help you installing Oracle Java 7. This is based on this WEBUPD8 procedure. The tests I’ve made were done on Ubuntu 12.04 and 12.10, and Mint Mate 14, but according to the WEBUPD8 post it should work from Ubuntu 10.04 up to the coming 13.04, and the corresponding Mint versions. Ok, let’s do it:

sudo add-apt-repository ppa:webupd8team/java

If this command fails reporting that add-apt-repository is missing, please run this command before the previous one:

sudo apt-get install python-software-properties

Then do the following commands

sudo apt-get update
sudo apt-get install oracle-java7-installer

After finishing the installation execute the following command in order to verify that the result is the expected:

java -version

You should see something like this:

java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)

The version number might change slightly depending of when you do it, this result was obtained today (Feb 1 2013). If the version is not the correct one (1.7) or if you are seeing OpenJDK there, please run the following additional command to select Oracle Java as the active Java stack:

sudo update-java-alternatives -s java-7-oracle

To uninstall it, just run:

sudo apt-get remove oracle-java7-installer

I hope it could be usefull, please comment with questions or corrections.

This entry was posted in Linux. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *