Tag Archives: openjdk

Installing Oracle JDK 7 on Ubuntu 12.04

– Download Java SE 7u4 from Oracle and Uncompress it
$ tar xf jdk-7u4-linux-x64.tar.gz

– JDK 7 package is extracted into jdk1.7.0_04 directory. Move this directory to /usr/lib/jvm/
$ sudo mv ./jdk1.7.0_04 /usr/lib/jvm/jdk1.7.0_04-sun

– Now run
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_04-sun/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_04-sun/bin/javac" 1
$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0_04-sun/bin/javaws" 1

– Set newly installed java as default
$ sudo update-alternatives --config java

– Verify version of new JDK 7 installation
$ java -version

– Repeate above steps for
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config javaws

UPDATE : Please read the update-alternatives(8) man page for information

Shamelessly copied from – http://askubuntu.com/questions/55848/how-do-i-install-oracle-java-jdk-7

Advertisements