There are circumstances where you may need to have more than one version of Java installed, but how do you switch between them?

Execute the following command to list the installed JVMs:

sudo update-alternatives --config java

Which will output something similar to the following:

There are 3 alternatives which provide `java'.

  Selection    Alternative
-----------------------------------------------
          1    /usr/bin/gij-wrapper-4.1
*         2    /usr/lib/jvm/java-1.5.0-sun/jre/bin/java
 +        3    /usr/lib/j2se/1.4/bin/java

Press enter to keep the default[*], or type selection number:

Simply enter the number for the JVM to use. The * shows the current selected JVM.


2 Comments

  1. Great,
    thank you! It was exactly what I needed

    Comment by mike — May 7, 2008 @ 4:10 am

  2. Thanks!

    Comment by KDV — November 26, 2008 @ 4:48 pm

RSS feed for comments on this post. TrackBack URL

Sorry, the comment form is closed at this time.