I am having issues updating Java. I am running Ubuntu 11.10.I can execute sudo apt-get install openjdk-7-jdk and it completes successfully. javac -version is 1.7, however java -version is 1.6. This is similar to this problem but my issue is not, as far as I can tell, the path.$ echo $PATH/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/gamesThanks.
Installing openjdk-7-jdk does not update java (which is still version 1.6)
ubuntu;upgrade;java
Update:Found a site that has a pretty good explanation: LINKFrom the link:Then we have to do some configuration.Debian has a script to maintain different version of programs like java called update-alternatives. update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0/bin/java 1065update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0/bin/javac 1065Where 1065 is a given priority.To check my installation i use config parameterupdate-alternatives --config javathis prints: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 modeAnd because 1065 is higher than 1061, the fresh installed java 7 will be used by default on my machinejava -versionprints: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/usr/bin/javaSLES11 # update-alternatives --list java/usr/lib64/jvm/jre-1.6.0-ibm/bin/javaSLES11 # update-alternatives --display javajava - 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-ibmCurrent `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/etc/alternativesSLES11 # lllrwxrwxrwx 1 root root 37 Mar 19 06:03 java -> /usr/lib64/jvm/jre-1.6.0-ibm/bin/javalrwxrwxrwx 1 root root 28 Mar 19 06:03 jre -> /usr/lib64/jvm/jre-1.6.0-ibmlrwxrwxrwx 1 root root 28 Mar 19 06:03 jre_1.6.0 -> /usr/lib64/jvm/jre-1.6.0-ibmlrwxrwxrwx 1 root root 36 Mar 19 06:03 jre_1.6.0_exports -> /usr/lib64/jvm-exports/jre-1.6.0-ibmlrwxrwxrwx 1 root root 36 Mar 19 06:03 jre_exports -> /usr/lib64/jvm-exports/jre-1.6.0-ibmlrwxrwxrwx 1 root root 28 Mar 19 06:03 jre_ibm -> /usr/lib64/jvm/jre-1.6.0-ibmlrwxrwxrwx 1 root root 36 Mar 19 06:03 jre_ibm_exports -> /usr/lib64/jvm-exports/jre-1.6.0-ibmMaking the change if you already have them installed and just need to change the default.SLES11 # update-alternatives --config javaThere is only 1 program which provides java(/usr/lib64/jvm/jre-1.6.0-ibm/bin/java). Nothing to configure.Original Answer:If you look in /etc/java or something like /etc/java-7-openjdk you should see the configuration files.java.conf or jvm.cfg 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.from CentOS java.conf# If you have the a base JRE package installed# (e.g. java-1.6.0-openjdk):#JAVA_HOME=$JVM_ROOT/jre# If you have the a devel JDK package installed# (e.g. java-1.6.0-openjdk-devel):#JAVA_HOME=$JVM_ROOT/java from Ubuntu jvm.cfg# 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.#-server KNOWN-client IGNORE-hotspot ERROR-classic WARN-native ERROR-green ERROR-jamvm KNOWN-cacao KNOWN-zero KNOWN-shark ALIASED_TO -zeroOn Ubuntu there is a program called update-java-alternativesThis is the top few lines of the man page  NAME       update-java-alternatives - update alternatives for jre/sdk installationsSYNOPSIS       update-java-alternatives [--jre] [--plugin] [-t|--test|-v|--verbose]             -l|--list []             -s|--set              -a|--auto             -h|-?|--helpDESCRIPTION       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 -s|--set               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.