Sunday, January 13, 2013

How to install Oracle JDK in Ubuntu 64bit

1) Download the JDK from oracle.
2) Extract and move it to /usr/lib/jvm
3) Update alternatives as following:
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_37/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_37/bin/javac" 1
$ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.6.0_37/jre/lib/amd64/libnpjp2.so" 1
$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.6.0_37/bin/javaws" 1
4) Choose defaults out of alternatives as following:
 $ sudo update-alternatives --config java
 $ sudo update-alternatives --config javac
 $ sudo update-alternatives --config mozilla-javaplugin.so
 $ sudo update-alternatives --config javaws
5) Set up JAVA_HOME and PATH environment variables in ~/.bashrc :
export JAVA_HOME=/usr/lib/jvm/jdk1.6.0_37
export PATH=$JAVA_HOME/bin:$PATH
6) Reload bash configuration:
dulanja@dulanja-t530:~$ su - dulanja
Password:
Done!

Ref:
[1] https://help.ubuntu.com/community/Java
[2] http://www.ubuntututorials.com/install-oracle-java-jdk-7-ubuntu-12-04/

No comments: