Found a site that has a pretty good explanation: LINK
From the link:
Then we have to do some configuration.
Debian has a script to maintain different version of programs like
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0/bin/java 1065
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0/bin/javac 1065
Where 1065 is a given priority.
To check my installation i use
update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
* 0 /usr/lib/jvm/jdk1.7.0/bin/java 1065 auto mode
1 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/jdk1.7.0/bin/java 1065 manual mode
And because 1065 is higher than 1061, the fresh installed java 7 will be used by default on my machine
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
Notes: This might make it more understandable.
SLES11 # which java
SLES11 # update-alternatives --list java
SLES11 # update-alternatives --display java
java - status is auto.
link currently points to /usr/lib64/jvm/jre-1.6.0-ibm/bin/java
/usr/lib64/jvm/jre-1.6.0-ibm/bin/java - priority 1608
slave rmiregistry: /usr/lib64/jvm/jre-1.6.0-ibm/bin/rmiregistry
slave tnameserv: /usr/lib64/jvm/jre-1.6.0-ibm/bin/tnameserv
slave rmid: /usr/lib64/jvm/jre-1.6.0-ibm/bin/rmid
slave jre_exports: /usr/lib64/jvm-exports/jre-1.6.0-ibm
slave policytool: /usr/lib64/jvm/jre-1.6.0-ibm/bin/policytool
slave keytool: /usr/lib64/jvm/jre-1.6.0-ibm/bin/keytool
slave jre: /usr/lib64/jvm/jre-1.6.0-ibm
Current `best' version is /usr/lib64/jvm/jre-1.6.0-ibm/bin/java.
The man page give the path that the update-alternatives uses for its directory.
SLES11 # pwd
SLES11 # ll
lrwxrwxrwx 1 root root 37 Mar 19 06:03 java -> /usr/lib64/jvm/jre-1.6.0-ibm/bin/java
lrwxrwxrwx 1 root root 28 Mar 19 06:03 jre -> /usr/lib64/jvm/jre-1.6.0-ibm
lrwxrwxrwx 1 root root 28 Mar 19 06:03 jre_1.6.0 -> /usr/lib64/jvm/jre-1.6.0-ibm
lrwxrwxrwx 1 root root 36 Mar 19 06:03 jre_1.6.0_exports -> /usr/lib64/jvm-exports/jre-1.6.0-ibm
lrwxrwxrwx 1 root root 36 Mar 19 06:03 jre_exports -> /usr/lib64/jvm-exports/jre-1.6.0-ibm
lrwxrwxrwx 1 root root 28 Mar 19 06:03 jre_ibm -> /usr/lib64/jvm/jre-1.6.0-ibm
lrwxrwxrwx 1 root root 36 Mar 19 06:03 jre_ibm_exports -> /usr/lib64/jvm-exports/jre-1.6.0-ibm
Making the change if you already have them installed and just need to change the default.
SLES11 # update-alternatives --config java
There is only 1 program which provides java
(/usr/lib64/jvm/jre-1.6.0-ibm/bin/java). Nothing to configure.
If you look in
/etc/java or something like
/etc/java-7-openjdk you should see the configuration files.
This is typically (depending) on the configuration file set your options. You can have several version of java installed at the same time and change the startup variables to effect which one is your default JVM.
# If you have the a base JRE package installed
# (e.g. java-1.6.0-openjdk):
# If you have the a devel JDK package installed
# (e.g. java-1.6.0-openjdk-devel):
# List of JVMs that can be used as an option to java, javac, etc.
# Order is important -- first in this list is the default JVM.
# NOTE that this both this file and its format are UNSUPPORTED and
# WILL GO AWAY in a future release.
# You may also select a JVM in an arbitrary location with the
# "-XXaltjvm=" option, but that too is unsupported
# and may not be available in a future release.
-shark ALIASED_TO -zero
On Ubuntu there is a program called
This is the top few lines of the man page
update-java-alternatives - update alternatives for jre/sdk installations
update-java-alternatives [--jre] [--plugin] [-t|--test|-v|--verbose]
update-java-alternatives updates all alternatives belonging to one runtime or development kit for the Java language. A package does provide these
information of it's alternatives in /usr/lib/jvm/..jinfo.
root@ubuntul:/# update-java-alternatives -l
java-1.6.0-openjdk 1061 /usr/lib/jvm/java-1.6.0-openjdk
Set all alternatives of the registered jre/sdk installation to the program path provided by the installation.
What I will typically also see are links in
/etc/profile.d for java startup environments.
My guess is that your java libraries were installed in the same place and the config files are still defaulting to the original version. You should just need to give the new JVM path.