nerdicism
Bitte denken Sie an die Umwelt bevor Sie diese Seite ausdrucken.
Create sane JDK installation using Sun´s RPMS and alternatives
Categories: Science & Technology | Written by ninan

Before there was OpenJDK, Linux distributions often lacked Java support at all or provided gcj as a very unpleasant alternative. A project that aimed at this issue was jpackage, who provided Source-RPMS to put Sun´s java downloads into sane RPMs. Unfortunately they do not seem to provide support for current versions of Sun´s java, now that most distributions come with OpenJDK.

Don´t get me wrong. I highly recommend to use OpenJDK if you don´t feel to need otherwise. But being a Java developer myself I find some things really annoying, so I still stick to Sun´s version of the great Java:

  • Speed – For example Netbeans runs way faster on Sun´s Java than on OpenJDK. Being my workplace for most of the time, that really matters
  • Font rendering – In Gnome and Fedora Netbeans looks not that well on OpenJDK, because anti-aliasing seems not to work too well. On Sun´s JDK in contrast…
  • Memory management seems to be a bit better on Sun´s JDK at the moment
  • Nimbus Look and Feel – I just like it

Sun (Oracle by now) offers two flavors of the JDK to download – one using RPM under the cover and one using cpio. Both come inside a big shell script aka self extracting archive that forces you to agree the licence before allowed to install.

Although there is a RPM version, it isn´t integrated into the operating system very tightly. On Fedora and derived distributions (I will only mention Fedora from here) there is that great “alternatives” system (actually it came from Debian, as far as I recall). This is a text file database, some scripts and a lot of symlinks. It lets several pieces of software share common names for programs and gives the user the choice which one to use.

On Fedora OpenJDK and GCJ share a lot of files, e.g. /usr/bin/java, /usr/bin/javac, etc. The Sun RPMs extract the files to some non-standard place, /usr/java/*. To make Sun´s JDK the system default, one has to change a lot of files and links, or use the alternatives system.

Since there are still plenty of files to provide alternatives for, I wrote a little script that will do the work. I tested it with Sun´s JDK 1.6.0_18 (RPM) on Fedora Core 12, but it should work with all versions from the Java 1.6.0 stem on Fedora and derived distributions.

One word of warning: The script is provided AS IS. I do not take any responsibility for whatever happens to you, your computer, etc. due using this script You use the script on YOUR OWN RISK.

The script is released to the public domain. Do what you want but don´t blame me. :-) If you like, please leave a comment if you liked it or have issues/patches.

So where is this §$%& script you are talking about? Click here to download the script.

Leave a Reply