Wednesday, March 16, 2011

How to make ubuntu 10.10 use Sun Java instead of OpenJDK

I had an issue where the default OpenJDK that comes with ubuntu 10.10 was not letting me run an applet I needed. Here is how in 6 commands you can switch from openJDK to Sun Java

sudo apt-get purge openjdk-6-jre openjdk-6-jre-headless
sudo add-apt-repository deb http maverick partner
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin
sudo apt-get install sun-java6-fonts
sudo update-java-alternatives --set java-6-sun

Line 1 : Removes OpenJDK from your machine
Line 2-3: Allows you to use the partner repository which has the sun packages and updates apt
Line 4-5: Installs the needed files needed for the Sun JRE to run
Line 6 : Tells your system to only use the sun java binaries.

Hope this helps