Friday, October 19, 2012

Install JDK6 on Ubuntu 12.04

1. Download binary file from http://www.oracle.com/technetwork/java/javase/downloads/jdk6u37-downloads-1859587.html

jdk-6u37-linux-x64.bin


2. Switch to root.
$ sudo -s

3. Move the file to JVM dir.
# cd /usr/lib/jvm/
# mv ~/Downloads/jdk-6u37-linux-x64.bin ./
# sh jdk-6u37-linux-x64.bin

4. Dir jdk1.6.0_37 is extracted, now install using update-alternatives
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_37/bin/java 1000
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_37/bin/javac 1000
update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_37/bin/javaws 1000

5. #update-alternatives --config java
Choose the option that you just installed.

6. Verify.
# java -version
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01, mixed mode)