Debian update-alternatives

A real brilliant feature of Debian is the alternatives system. Couple of days ago i was playing with java. and I wanted both the Sun java and the Kaffe version installed on my system. The problem here is, how to easily tell wich java compiler to use, the sun version or kaffe? I’m a big fan of the ruby language and i regularly switch between version of the ruby interpeter for testing. You could achieve this in a couple of ways, change the shebang to point to the correct version of the interpeter or don’t use the shebang but instead call the correct interpeter before executing each script or maybe you change the PATH and have the preferred interpeter somewhere in the beginning of your PATH. I don’t really like any of these solutions for various reasons, there is a solution and you might have guessed it “the alternatives system”.