Oracle JDK7 on Ubuntu

How to manually install the official Oracle JDK7 including the Mozilla Firefox Java-Plugin on Ubuntu 12.04 LTS (this example is based on JDK7 update 11 with important security fixes – just replace the version to a more recent one):

download most recent JDK version from Oracle website:

  • http://www.oracle.com/technetwork/java/javase/downloads/index.html

extract to /usr/lib/jvm directly:

  • cd /usr/lib/jvm
  • sudo tar xvzf /path/to/download/folder/jdk-7u11-linux-x64.tar.gz

install the new Java installation to the Ubuntu „alternatives“ system:

  • sudo update-alternatives –install „/usr/bin/java“ „java“ „/usr/lib/jvm/jdk1.7.0_11/bin/java“ 1
  • sudo update-alternatives –install „/usr/bin/javac“ „javac“ „/usr/lib/jvm/jdk1.7.0_11/bin/javac“ 1
  • sudo update-alternatives –install „/usr/bin/javaws“ „javaws“ „/usr/lib/jvm/jdk1.7.0_11/bin/javaws“ 1

now configure the alternatives and select the newly available option as default (in the normal case it will be the last option of the list, just check the path to the java installation …)

  • sudo update-alternatives –config java
  • sudo update-alternatives –config javac
  • sudo update-alternatives –config javaws

Install Mozilla Firefox Plugin (for 64bit):

  • mkdir ~/.mozilla/plugins (if not existent yet)
  •  ln -sf /usr/lib/jvm/jdk1.7.0_11/jre/lib/amd64/libnpjp2.so ~/.mozilla/plugins/