Gentoo Linux has a very nice java integration; you can have more than one JDK distributions in your machine and switch the VM in system-wide and per-user manner. To switch your current VM, you can simply enter ‘java-config —set-user-vm=VM‘ and that’s all.
However, you need to know how java-config works if you want to add any JDK which is not in the portage. It’s pretty simple to add a JDK, but it can be tricky for a beginner. Please follow the following steps:
- Install your JDK somewhere. (e.g. 1.6.0.10-beta in /opt/sun-jdk-1.6.0.10)
- Add the profile of the newly installed JDK into /usr/share/java-config-2/vm/. Copy from an existing one and replace some version numbers. (e.g. cp sun-jdk-1.6 sun-jdk-1.6.0.10; perl -pi -e “s/1\.6\.0\.03/1.6.0.10/g” sun-jdk-1.6.0.10)
- Create a symbolic link to the JDK directory in /usr/lib/jvm/. (e.g. ln -s /opt/sun-jdk-1.6.0.10)
- Confirm that the new VM is recognized by java-config by typing ‘java-config -L‘.