This article will answer following questions

  1. I have installed Open JDK from Ubuntu software center now I want to set Oracle Java as my default Java lib how to do?
  2. I have installed Elcipse from Ubuntu software center, now I want Oracle java as default java lib what to do?

Very simple, just follow below steps one by one.

  1. Download Oracle Java
  2. Make sure its installed under /usr/lib/jvm directory
  3. We have installed and tested jdk1.6.0_07 successfully with Ubuntu 12.04 and tested and working fine.

 

Update from Openjdk to Oracle jdk

sudo update-alternatives –install “/usr/bin/java” “java” “/usr/lib/jvm/jdk1.6.0_07/bin/java” 1
sudo update-alternatives –install “/usr/bin/javac” “javac” “/usr/lib/jvm/jdk1.6.0_07/bin/javac” 1
sudo update-alternatives –install “/usr/bin/javaws” “javaws” “/usr/lib/jvm/jdk1.6.0_07/bin/javaws” 1
sudo update-alternatives –install “/usr/bin/jar” “jar” “/usr/lib/jvm/jdk1.6.0_07/bin/jar” 1

 

the following is obsolets if there are no alternatives

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