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. 184.108.40.206-beta in /opt/sun-jdk-220.127.116.11)
- 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-18.104.22.168; perl -pi -e “s/1\.6\.0\.03/22.214.171.124/g” sun-jdk-126.96.36.199)
- Create a symbolic link to the JDK directory in /usr/lib/jvm/. (e.g. ln -s /opt/sun-jdk-188.8.131.52)
- Confirm that the new VM is recognized by java-config by typing ‘java-config -L‘.