Search This Blog

Friday, May 11, 2012

Installing JDK 1.6 on Ubuntu

  • Installing Sun JDK 1.6: You can download oab-java6 zip file from this URL , then you will need to extract this zip file and open the terminal (pressing ctrl+alt+t) to run ./ You must be run this command as sudo (using a root account).

Installing JDK 1.6 on Ubuntu

 This script is doing the following:
The basic execution steps are:
  • Remove, my now disabled, Java PPA 'ppa:flexiondotorg/java'.
  • Install the tools required to build the Java packages.
  • Create download cache in /var/local/oab/pkg.
  • Download the i586 and x64 Java install binaries from Oracle. Yes, both are required.
  • Clone the build scripts from
  • Build the Java packages applicable to your system.
  • Create local apt repository in /var/local/oab/deb for the newly built Java Packages.
  • Create a GnuPG signing key in /var/local/oab/gpg if none exists.
  • Sign the local apt repository using the local GnuPG signing key.
What if this script didn't go well with you ? on of the problems you may face is throwing an error saying "Error: Package sun-java6-jdk is not available, but is referred to by another package"

You can run the following in the terminal :

sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jdk

By previous steps, it is expected that you have installed JDK 1.6 on your systems. The only remaining step is to set the class path of Java by the following commands:

export JAVA_HOME=/usr/lib/jvm/java-6-sun

To ensure that the new Java Home is set correctly, you can print (echo) the JAVA_HOME environment variable by the following command: