January 13, 2011

Installing Sun Java on Ubuntu

It can be easy to forget how to install the "real" Java on a Debian system. There is that one command which seems to trip many people up.


The Sun Java is not really "free' software and is therefore not in the normal Ubuntu repositories. Therefore it is necessary to edit the /etc/apt/sources.list file and un-comment the

vi /etc/apt/sources.list

Look for the 'partners' section and un-comment both of the relevant lines:

deb http://archive.canonical.com/ubuntu natty partner
deb-src http://archive.canonical.com/ubuntu natty partner

Now the Sun Java runtime is available for download and installation as normal:

sudo apt-get update
sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk

Accept the license if you want the application installed. Press the tab key to move to the appropriate fields.

Now for the part many forget. Ubuntu Linux comes with update-java-alternatives utility to update all alternatives belonging to one runtime or development kit for the Java language. To select Sun's JVM as one provided in Ubuntu, enter the following command:

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

Run java -version to ensure that the correct version is being called.

$ java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)
$

That is all there is to it. Basically five commands to enter and a little file editing and you are running the "official" Java in under 3 minutes.
Continue reading...

About This Blog

This is a low frequency blog on implementing SOA designs using message brokering. It is a list of practical tips developed over several years deploying service oriented systems for targeted and mass deployments in the telecommunications carrier and electric utility markets.

Recent Articles

Blog Archive

   Copyright © Steve Coté - All Rights Reserved.

Back to TOP