Sunday, April 8, 2018

Switch Java version in Ubuntu

Use update-alternative command to change the default Java version:
$ sudo update-alternatives --config javac
There are 2 choices for the alternative javac (providing /usr/bin/javac).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-7-openjdk-amd64/bin/javac ...
1 /usr/lib/jvm/java-7-openjdk-amd64/bin/javac ...
2 /usr/lib/jvm/java-8-openjdk-amd64/bin/javac ...
Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/javac to provide /usr/bin/javac (javac) in manual mode

$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java ...
1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java ...
2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java ...
Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in manual mode

Featured Post

British-based startup ARC unveiled its first motorcycle model in Milan this week

One being described as fast, advanced and expensive. The so-called Vector costs more than $100,000