set default java version

Posted by Dónal on Ask Ubuntu See other posts from Ask Ubuntu or by Dónal
Published on 2013-06-15T22:36:22Z Indexed on 2014/06/13 15:42 UTC
Read the original article Hit count: 392

Filed under:
|
|

I have been using Java 6 on Ubuntu 11.10, but now I want to update to version 7. I've installed version 7 via PPA as described here. If I run

sudo update-alternatives --config java

I get the following output:

There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                     Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-7-oracle/jre/bin/java   64        auto mode
  1            /usr/lib/jvm/java-6-sun/jre/bin/java      63        manual mode
* 2            /usr/lib/jvm/java-7-oracle/jre/bin/java   64        manual mode

Similarly, if I run:

sudo update-alternatives --config javac

I get the output:

  Selection    Path                                  Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-7-oracle/bin/javac   64        auto mode
  1            /usr/lib/jvm/java-6-sun/bin/javac      63        manual mode
* 2            /usr/lib/jvm/java-7-oracle/bin/javac   64        manual mode

So it looks like version 7 is already the default. But if I run either

java -version

or

javac -version

The output indicates that version 6 is still the default. How can I set the default to version 7?

© Ask Ubuntu or respective owner

Related posts about 11.10

Related posts about java