How To Install Sun Java (JDK/JRE) in Ubuntu

Starting with Ubuntu 10.04, Sun Java packages are not included in the Ubuntu archive. Instead of Sun JDK and JRE, Ubuntu now comes with OpenJDK.

We encourage you to use the open source java development environment, OpenJDK, instead of Sun’s proprietary version. But if, for some reason, you still want to install SUN Java on Ubuntu, then here’s the procedure.

Installing Sun Java (JDK / JRE) in Ubuntu

Open terminal, and execute the following commands one by one.

sudo add-apt-repository “deb lucid partner”
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin
sudo update-alternatives –config java

This will install Sun JDK 6 and JRE 6 on your Ubuntu linux system.