Friday, April 25, 2014

Installing Oracle JDK 7 on Ubuntu 12.04, 13.04 and 14.04 server and desktop editions

Java 7 on Ubuntu

Oracle no longer allows to redistribute new Oracle Java packages.  Resulting into Canonical (company behind Ubuntu) not able to ship Oracle JDK with ubuntu.  The simplest way I found is to use PPA.

#  install the package python-software-properties - it requires for the PPA
$ sudo apt-get install python-software-properties

# delete the existing openjdk packages
$ sudo apt-get purge openjdk*

# add the ppa java repository
$ sudo add-apt-repository ppa:webupd8team/java

# refresh the aptitude repository
$ sudo apt-get update 

# install the oracle java 7 SDK
$ sudo apt-get install oracle-java7-installer

# check the java version
$ java -version

# set the oracle java 7 SDK as default java sdk
$ sudo apt-get install oracle-java7-set-default

# remove the oracle java 7 SDK
$ sudo apt-get install oracle-java7-set-default

These commands work for me on Ubuntu 12.04, 13.04 and 14.04 server and desktop editions with JDK 7.  The PPA repository added to aptitude can also be used to install jdk 6 and java 8.

More information can be found on Web Upd8 blog.


No comments :

Post a Comment