Install Sun Java under Debian Squeeze

Debian Squeeze for AMD64 comes with OpenJDK Java preinstalled and ready to run. If you, for whatever reason, need to install Sun Java, the Sources list has to be modified:

Edit /etc/apt/sources.list, add “non-free”:

deb squeeze main non-free


ron@ron:~$ apt-get update

Check for available Sun Java Packages:

ron@ron:~$ apt-cache search sun-java6

The result may look something like this:

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

Now install what you need, minimum is sun-java6-bin:

ron@ron:~$ apt-get install sun-java6-bin sun-java6-javadb sun-java6-jdk sun-java6-plugin

In order to accept the License Agreement, navigate to the Accept field with TAB.

Make Sun Java the Java runtime of your choice:

ron@ron:~$ update-java-alternatives -s java-6-sun

Check, if Java could be properly installed:

ron@ron:~$ java -version

java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)

Set Environment Variable $JAVA_HOME

Edit file /etc/profile, add:

export JAVA_HOME