/etc/alternatives mess

July 18, 2008

Fedora insists on not shipping Sun Java because it didn't fall into the open source definition of free. Something that can be downloaded free of charge isn't free. Even if the source code is shipped free of charge, that still doesn't make it a free software. But then sun java changed their license model and by any stretch of the imagination it should now be called free. So Fedora 9 and Debian should both include it by default. Unfortunately debian doesn't. I am not sure if Fedora 9 does; I didn't bother to find out.

Previous versions have also been plagued by the gcj and /etc/alternatives mess. The standard way to configure /etc/alternatives to use the Sun JVM is to say

update-alternatives --config java

But that croaks out with:

"There is only 1 program which provides java"

Sure you can now install java with synaptic. But why should I? I have countless versions of the Sun JVM and JDK lying around on my hard drives. So what I did was to copy over the old /usr/java folder from Fedora Core 6. This folder contains serveral different versions of java and looks something like this:

lrwxrwxrwx 1 root root   12 2008-07-18 11:24 1.3 -> jdk1.3.1_18/
lrwxrwxrwx 1 root root   11 2008-07-18 11:24 1.4 -> j2sdk1.4.2/
lrwxrwxrwx 1 root root   12 2008-07-18 11:24 1.5 -> jdk1.5.0_06/
lrwxrwxrwx 1 root root   12 2008-07-18 11:24 1.6 -> jdk1.6.0_02/
lrwxrwxrwx 1 root root   12 2008-07-18 11:24 default -> jdk1.5.0_06/
drwxr-xr-x 8 root root 4096 2006-05-04 16:51 j2sdk1.4.2
drwxrwxr-x 9 root root 4096 2006-03-10 07:00 jdk1.3.1_18
drwxr-xr-x 9 root root 4096 2006-05-04 16:51 jdk1.5.0_06
drwxr-xr-x 9 root root 4096 2007-06-15 06:33 jdk1.6.0_02

As you can see, each of the major version numbers are represented by symlinks that point to the current (well in some cases not so current) release for that branch.

Next the symbolic links in /etc/alternatives/ were deleted and fresh links were created to the /usr/java/1.6 folder above. If I update my 1.6 branch, all I have to do is to change the symlink from jdk1.6.0_02 to whatever the current version is.

If I want to use java 7, I just download it and expand it into the /usr/java folder. Then a symlink name 1.7 is created to point to the exact release and then the link in /etc/alternatives is updated. In fact I am going to do all that right now (with java 7)

Posted by raditha at July 18, 2008 6:07 AM
Your Ad Here

 

Jabber  |  Linux  |  mySQL  |  PHP  |  Java  |  Site Map  |  Wiki

Downloads  |  About  |  Links  |  Contact  |  Home

 

Copyright © Raditha Dissanayake 2003 - 2007

Terms of Use  |  Privacy

 

 

July 2008
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31