Installing Sun JDK instead of OpenJDK on Ubuntu

By default Ubuntu comes with OpenJDK. Most developers prefer closed source JDK instead of OpenJDK. But in version Ubuntu 10.10 the closed source version of JDK is not listed in apt-get list. So it makes some difficulties removing OpenJDK.

First of all you need install JDK and for it you need add this line to apt-get source list. Open /etc/apt/sources.list file and append this line there:

cd /etc/apt/
echo "deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse" >>sources.list

Update the repository

apt-get update

Install packages sun-java6-jre and sun-java6-jdk

apt-get install sun-java6-jre
apt-get install sun-java6-jdk

Update environment to use just installed JDK

update-java-alternatives -s java-6-sun

Uninstall unused openjdk-6-jre-lib package

apt-get remove openjdk-6-jre-lib

For testing purpose type following command in shell:

java -version

If you see something like this so everything is OK

java version "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)

Facebook comments:

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">