Monday, January 26, 2015

Installing Oracle Java in Ubuntu, Something I seem to do a lot!

I create Virtual Box Virtual Machines for just about every project, so I end up installing Java on them a lot. I like the Oracle JDK, but for licensing reasons, that install is not available as part of the "normal" apt repository.

I installed Java via a PPA (http://askubuntu.com/questions/4983/what-are-ppas-and-how-do-i-use-them) by webupd8team (http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html). I ran these commands to add the PPA to the apt-get repo and update that repo, install Java7, and set up the various java 7 environment variables.

add-apt-repository ppa:webupd8team/java

apt-get update
apt-get install oracle-java7-installer
apt-get install oracle-java7-set-default

This installs the java 7 version. Same commands work with 8 by changing the version number.