Tuesday, December 23, 2008

Install Java 6 on Ubuntu 8.10

There are several ways of installing Java on the Ubuntu operating system. One of the easiest ways is to make use of apt-get command in Ubuntu.

Setup Repository

The apt-get command makes use of a source configuration file, which contains a list of the repositories the package manager should query to retrieve the correct package. The source configuration file is known as sources.list and is situated in the /etc/apt/sources.list location. The following command can be used to edit the source file to ensure the multiverse repository is included.


sudo gedit /etc/apt/sources.list

Ensure that the following two sources are added to the configuration file:

deb http://za.archive.ubuntu.com/ubuntu/ intrepid main restricted

deb http://za.archive.ubuntu.com/ubuntu/ intrepid multiverse

After the configuration file is updated, the package repository needs to updated with the following command:


sudo apt-get update

Install Java Package

After the package repository was successfully updated, the Sun Java packages can be installed on the Ubuntu system. The Sun Java packages consist of Java 5 and Java 6 packages. Depending on the version that is required, the list of packages specified below can be installed.

Java 5
The Java 5 packages available is listed as follows:

  • sun-java5-bin
  • sun-java5-fonts
  • sun-java5-plugin
  • sun-java5-demo
  • sun-java5-jdk
  • sun-java5-source
  • sun-java5-doc
  • sun-java5-jre
  • sun-java5-src

Java 6
The Java 6 packages available is listed as follows:

  • sun-java6-bin
  • sun-java6-javadb
  • sun-java6-plugin
  • sun-java6-demo
  • sun-java6-jdk
  • sun-java6-source
  • sun-java6-doc
  • sun-java6-jre
  • sun-java6-src
  • sun-java6-fonts
  • sun-java6-jre-headless

To install Java version 6, the following command needs to be executed:


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

Verify Java Installation

To verify that the correct version of java is installed the following command can be used:


java -version

This command will print the current version of java that is active. Should there be more than one version of Java be installed on the operating system, the following command can be used to list the available java versions:


update-java-alternatives -l

This command list all the available Java runtime environments on the Ubuntu system. To change from one version to another, the following command can be used:


sudo update-java-alternatices -s

Testing Java Runtime Environment

You’ll want to confirm that your system is configured properly for Sun’s JRE. This is a two-step process.

First, check that the JRE is properly installed by running the following command from a terminal.

java -version

You should get similar output

java version “1.6.0″
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
Testing Java Plugin for Firefox

open Firefox and typing about:plugins in the address bar and check for java plugin

No comments: