Installing Java 2 on Debian, The Debian Way

I can never remember how to install Java on Debian, so here’s my version on how to do it the Debian Way (TM).

Download the Sun Java 2 Runtime environment or Development Kit from Sun’s Java site. The file you download should have a “.bin” extension. Then install:

apt-get install java-package fakeroot

java-package is a set of Debian scripts for creating your own Debian-ized Java package. fakeroot lets you run certain programs as root, such as the Debian package creation process. After these are installed, run:

fakeroot make-jpkg jdk-.bin sudo dpkg -i sun-j2sdk.deb

The first creates a Debian package from the Sun binary installer, while the second installs the created Debian package.

This will fulfill all Java dependencies in Debian, something you would not get if you installed Java via some other method. It’s also the “official” Java, as opposed to using something like Blackdown, and makes you less reliant on having to rely on other people for packaging. For example, I used this to create my own AMD64 64-bit Java package.

Like this article? Please support my writing! Flattr my blog (see my thoughts on Flattr), tip me via PayPal, or send me an item from my Amazon wish list.