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.
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.
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:
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.
The Java 5 packages available is listed as follows:
The Java 6 packages available is listed as follows:
To install Java version 6, the following command needs to be executed:
Verify Java Installation
To verify that the correct version of java is installed the following command can be used:
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:
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.
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