Ubuntu – How to set default Java version on Ubuntu

By | 2019-02-27T09:52:27+05:30 February 27th, 2019|linux|

Here I am going to show how to set default Java version on ubuntu when we have multiple java versions installed.

How to set default Java version on Ubuntu:

It is very simple to set default java version on windows operating system through a beautiful GUI (environment variables), but when coming to the Linux flavors everything has to be addressed on a terminal window through commands.

however, this article helps you to make a specific java version as a default, when you have multiple Java versions installed on your machine.

Set default Java version on Ubuntu:

Currently, I have two different Java versions (Java 8 and Java 11) installed on my machine and Java 8 is acting as default.

set Default Java Version on Ubuntu

Now I am going to change the default Java 8 to 11 using update-alternatives –config java command.

Default Java Version On Ubuntu

It will ask you to enter your choice to make the default Java version. Choose selection number and press enter. Now your default java version has been updated to Java 11.

It is also equally important to change the javac default version when you change the java default. you can do this by giving the below command.

Default Java Version 2-min

Verification:

Check the java -version, and javac -version

Default Java Version 4-min

References:

Happy Learning 🙂

About the Author:

Hi Folks, you have reach this so far, that shows you like what you are learning. Then why don't you support us to improve for bettor tutorials by leaving your valuable comments and why not you keep in touch with us for latest updates on your favorite blog @ facebook , twitter , Or Google+ ,

Leave A Comment