LKBEN11079: Howto install sun java on debian 5.0 lenny


Symptom

You need to install sun java and cannot find it in the package list

Cause

This is by design

Solution

Sun java is in the non-free part of debian. This is not activated by default in your sources.list. To install sun java we first have to change sources.list. This can be done as root with a normal text editor.

The only thing you have to add is the non-free word after main. (see below)
Your sources.list should look like this:

----
#
# deb cdrom:[Debian GNU/Linux 5.0.0 _Lenny_ - Official amd64 CD Binary-1 20090214-19:11]/ lenny main

#deb cdrom:[Debian GNU/Linux 5.0.0 _Lenny_ - Official amd64 CD Binary-1 20090214-19:11]/ lenny main

deb http://ftp.de.debian.org/debian/ lenny main non-free
deb-src http://ftp.de.debian.org/debian/ lenny main non-free

deb http://security.debian.org/ lenny/updates main
deb-src http://security.debian.org/ lenny/updates main

deb http://volatile.debian.org/debian-volatile lenny/volatile main
deb-src http://volatile.debian.org/debian-volatile lenny/volatile main
---

Once this has been done you need to update your packages with:
apt-get update

With the following command you can search your system for everything with java and sun.

apt-cache search java|grep sun

The result looks like this:

sunflow - rendering system for photo-realistic image synthesis
iceweasel-greasemonkey - Iceweasel-Erweiterung, die Anpassungen von Webseiten durch Skripte erlaubt
ia32-sun-java5-bin - Sun Java(TM) Runtime Environment (JRE) 5.0 (32-bit)
ia32-sun-java6-bin - Sun Java(TM) Runtime Environment (JRE) 6 (32-bit)
sun-java5-bin - Sun Java(TM) Runtime Environment (JRE) 5.0 (architecture dependent files)
sun-java5-demo - Sun Java(TM) Development Kit (JDK) 5.0 demos and examples
sun-java5-doc - Sun JDK(TM) Documention -- integration installer
sun-java5-fonts - Lucida TrueType fonts (from the Sun JRE)
sun-java5-jdk - Sun Java(TM) Development Kit (JDK) 5.0
sun-java5-jre - Sun Java(TM) Runtime Environment (JRE) 5.0 (architecture independent files)
sun-java5-source - Sun Java(TM) Development Kit (JDK) 5.0 source files
sun-java6-bin - Sun Java(TM) Runtime Environment (JRE) 6 (architecture dependent files)
sun-java6-demo - Sun Java(TM) Development Kit (JDK) 6 demos and examples
sun-java6-doc - Sun JDK(TM) Documention -- integration installer
sun-java6-fonts - Lucida TrueType fonts (from the Sun JRE)
sun-java6-javadb - Java(TM) DB, Sun Microsystems' distribution of Apache Derby
sun-java6-jdk - Sun Java(TM) Development Kit (JDK) 6
sun-java6-jre - Sun Java(TM) Runtime Environment (JRE) 6 (architecture independent files)
sun-java6-plugin - The Java(TM) Plug-in, Java SE 6
sun-java6-source - Sun Java(TM) Development Kit (JDK) 6 source files

To install your sun java environment you need to know what you want to install. The runtime or the development environment. To run java applications you just need the runtime, otherwise you need the development Kit.

In this case we install the Java development kit with:

apt-get install sun-java5-jdk

You can test your result on a console by typing

java -version

The result should look like this:

java version "1.5.0_17"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_17-b04)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_17-b04, mixed mode)

You still might have to change your alternatives for java to get sun java as the default java executable!

Disclaimer:

The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!

About the Author

Author: Wim Peeters - Keskon GmbH & Co. KG

Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.