Getting Sun Java 5 On Debian 4.0: So Easy
First the goods.
The official Debian 4.0 contains Sun JDK 5 in its non-free section. To get it, you edit /etc/apt/sources.list to enable the non-free repository, and then run apt-get install sun-java5-jdk.
Here's my /etc/apt/sources.list (with my changes high-lighted in red):
# # deb cdrom:[Debian GNU/Linux 4.0 r0 _Etch_ - Official amd64 DVD Binary-1 200704 07-12:15]/ etch contrib main deb cdrom:[Debian GNU/Linux 4.0 r0 _Etch_ - Official amd64 DVD Binary-1 20070407 -12:15]/ etch contrib main deb http://ftp.debian.org/debian/ etch main non-free deb-src http://ftp.debian.org/debian/ etch main non-free deb http://security.debian.org/ etch/updates main contrib deb-src http://security.debian.org/ etch/updates main contrib
Running apt-get install sun-java5-jdk caused apt-get to include several other dependencies and suggested other packages to install. I installed the suggested packages as well, with the exception of the plugin packages, which do not exist for the AMD64 architecture.
When I did the Google search, there are suggestions for using the testing or unstable repositories. My local Debian expert warned me that enabling unstable repositories may have far reaching consequences affecting every aspect of the system. So I'll refrain from going there until I've learned a bit more of how Debian works. According to Sun folks, Java 6, NetBeans 5 and GlassFish 1 are in the unstable repository.
Now the essay. (I started this post here, but it got a bit long. So I added the instructions at the top.)
Unlike on Windows or the Mac, there have always been multiple ways to install Sun's JDK on Linux systems:
- Download a self-extracting rpm from Sun and install it
- Download a self-extracting binary from Sun and install it
- Getting it from your Linux distribution's packages repo
Every time someone like me asks the question "How do I get Java for my Linux," the advice we get usually points to a Sun download. This has always worked fine for me and is the way to go when I wanted the latest and greatest JDK. All the navigating and clicking is a bit annoying but nothing unusual.
However, there are several drawbacks of this approach, some perceived and some actual:
- It doesn't feel right
- It's not hooked into the dependency management infrastructure of the Linux distribution
- It's more complicated than the process of getting other programming languages
Added to the confusion is the fact that many Linux distributions supply an alternative, incomplete, but free software implementation of Java in the form of GNU gcj, GNU Classpath and the Eclipse compiler, which are hooked into the dependency management system (meaning you cannot easily get rid of it without also having to get rid of hundreds of other packages, including OpenOffice.org.)
That is why I was excited about JPackage.org's effort to create properly dependency managed packages for the various non-free (Sun, IBM, BEA) JDKs. However, Sun's licensing terms of their JDK made this process more complicated than it needs to be.
The licensing term was relaxed in 2006 to enable Linux distributions such as Debian and Ubuntu and Fedora to include Sun's JDK in their distributions. And the official Ubuntu and Debian releases now does indeed include packages for Sun Java. With this addition, installing Sun JDK is as easy as installing, say, Ruby:
(Go back to the top of this blog entry to see how easy it really is.)