Home > Java, Linux > Update-alternatives


Having multiple jvm’s on your linux machine can be a pain in the ass. To select which jvm to use you can use the update-alternatives command. A small example of how to add a jvm to the alternatives here:

update-alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_11/bin/java 16011

This will add an entry for your jdk into the alternatives. The last number assigns the priority to this alternative. Which is the version and build number of the relase.

After adding you can use the following command to select the java version you want to use:

update-alternatives --config java

If you switch the java update-alternatives to auto it will automatically pick the java alternative with the highest priority.

  1. April 22nd, 2009 at 20:40 | #1

    Good post.

  2. Wytze
    April 24th, 2009 at 08:39 | #2

    Thank you

  1. No trackbacks yet.

Time limit is exhausted. Please reload CAPTCHA.