Friday, December 08, 2006

Install Sun Java on Debian Linux.

Installing the Java Runtime environment or Java Software Development kit on Debian Linux.

Introduction:
Currently there is no Sun Java shipped with the distributions of Debian because there are legal issues concerning the shipping of java together with Debian. The intention of Debian is provide a complete opensource operating system and as Java is Free but legally not totally open source in a GNU/GPL kind of way Debian is not willing to ship it with its standard releases.

At this point in time there are some discussions in the Debian development community together with Sun Microsystems to try to change some of the legal boundaries of Sun Java to make it possible for Debian to include it in there distribution however at this moment no Java is included as a standard Debian package.

As some applications require you to have a Java virtual machine present you can be forced to install this on your Debian Linux system.

Installation:
Please follow the installation steps as mentioned below. All steps are mandatory for the installation so none of the steps should be skipped.

Installation step 1:
First you will have to download the Debian ‘java-package’. The ‘java-package’ is an instruction set to be able to transform the .bin files you download from the Sun website to .deb files to be used by the Debian installer. The ‘java-package’ can be downloaded using the Debian apt-get tool. apt-get is the command-line tool for handling packages, and may be considered the user's "back-end" to other tools using the APT library.

As we already stated, Java is not a standard ‘function’ in Debian and therefore the tools to install the Java are also not in the standard sections where apt-get will search for packages by default. It is however in the ‘contrib’ section which you will have to add in the apt-get source file.

The source file can be found at: ‘/etc/apt/sources.list’.
A example of how to change the sources.list file:
deb http://ftp.us.debian.org/debian sarge main contrib non-free

Execute the apt-get update command so apt-get will be working with the extra sources mentioned in the sources.list file.
#apt-get update

Now download and install the ‘java-package’ by executing the following command:
#apt-get install java-package

Installation step 2:
Acquire the Java Linux installation file from the Sun website. Make sure you download the .bin file for Linux and that it is supported by the ‘java-package’. If you have doubts the version you like to install is supported your currently installed java-package please verify this at the java-package website:

http://packages.debian.org/stable/misc/java-package

We will continue with 'jdk-1_5_0_06-linux-i586.bin' downloaded from the Sun Microsystems website.

Installation step 3:
To be able to install java on Debian you have to change the .bin file format into the Debian installation format .deb . To do so make sure you are not logged in to the system as root and execute the following command:
#fakeroot make-jpkg jre-1_5_0_06-linux-i586.bin

This should have generated a file called jre-1_5_0_06-linux-i586.deb

Installation step 4:
Now you will be able to install the java .deb package on Debian by executing the following command:
#dpkg –I jre-1_5_0_06-linux-i586.deb

Installation step 5:
Basically you are done with the installation of Java on your Debian system. Optionally you can verify the correct installation on your system by executing the following command:

#java -version

Troubleshooting the installation:
Errors when issuing make-jpkg
If you encounter problems when issuing the above make-jpkg command, make sure you have the latest version of java-package, currently (2005-11-17) version 0.25 or newer is recommended for everything to go smoothly, but 0.24 should work fine as long as one isn't effected by bug #313555.

With older versions of java-package one may receive an error message that says "No matching plugin was found" when attempting to create a package of the latest Java 1.5.0 (JRE/JDK 5.0 Update 6) or the IBM Java, or get some other errors.

If you are unsure, you can check your version of java-package by issuing the following command:
#apt-cache policy java-package | head -2

If you are using Debian 3.1 'sarge' and java-package 0.24 is not working for you, you need to install java-package 0.25 or newer, but that is currently only available in testing ('etch'), so use Apt-Pinning to make packages from 'etch' available, and install java-package from there by:
#apt-get install java-package/testing

or if the dependencies of java-package cannot be fulfilled from stable, install with:
#apt-get install java-package -t testing



Post a Comment