Skip to main content

Ubuntu and easily installable JDK's

Posted by robogeek on May 1, 2007 at 4:16 PM PDT

Last week that Feisty Fawn escaped the group at Ubuntu and caused quite a splash in Javaland by having The JDK easily installable. As an Ubuntu user I'm happy about this, and as a DLJ project member I'm even happier that our work has enabled this to happen. One of our initial goals with the DLJ project was to make it trivial(er) to install Java applications .. e.g. so easy that "apt-get install glassfish" would Just Work.

I listened to the latest Javaposse podcast (episode #117) and they had a little bit of confusion over what's what.

I just went through installing a fresh Ubuntu (inside a virtual machine). Upon bootup and immediately running a terminal and typing "java -version" I'm told the Java version is 1.4.2 and the interpreter is "gij". Okay, clearly whatever was bundled is not Sun's JDK. So what's all this hoopla about Java being there? No doubt this is the source of their confusion.

What's most likely going on is ... Ubuntu is redistributing bundles derived from the DLJ project distribution of Sun's JDK. The DLJ binaries are essentially the same as the normal binary package one downloads from java.sun.com. The difference is the license, which is still a non-open-source binary only license, with the advantage that the DLJ license explicitly allows for redistribution of the binary pretty widely. Another difference is the DLJ bundles do not have an installer. It is meant that operating system distributors ... such as Ubuntu, Debian, Gentoo, Mandriva .. each of whom have used the DLJ to redistribute the DLJ bundles .. that operating system distributors will grab the DLJ bundle and repackage it for their own systems. Details are on the DLJ project site linked above.

Since the DLJ bundles are not under an open source license, Ubuntu most likely could not redistribute those bundles in their download. The rules for the core Ubuntu distribution must be that it's open source, and obviously the DLJ bundles are not under an open source license.

Fortunately it's real easy to enable download of Sun's JDK plus Netbeans plus Glassfish. And it's real simple.

Head to the System menu, select Administration, then Synaptic Package Manager. The Synaptic thing is the Debian/Ubuntu GUI for doing package management, and it's really nice. It's one of the things which has kept me a happy Ubuntu user for nearly 2 yrs.

Click on Search and in the dialog box enter "sun-java". You'll get a list including sun-java5 and sun-java6 choices. You probably want sun-java6 because that's the current and up-to-date version. While you're here you can also search for netbeans and glassfish and install those if you like. To select one of the packages to install, right click the box on the leftmost end of the item listings, in the popup menu select the choice about installing the thingamajob, and possibly a dialog box will come up and you can click OK on that.

An interesting thing I learned is that installing Glassfish causes an install of sun-java5, even though I had already selected an install of sun-java6. No doubt someone got a dependency a little bit cockeyed. I sure Glassfish runs fine on sun-java6 ...

During the installation you'll be asked to agree to some licenses.

Once installed you should go to a root shell and run the update-java-alternatives command. The option "--help" shows you all the options, using "--list" shows you the available java alternative implementations installed on your system, and using "--set" lets you choose one of them as the default alternative.

That's it. Enjoy.

Related Topics >>