How To Switch Java Version On Linux Ubuntu

Java is a programming language that has been around for over 20 years and it is still widely used in the development of enterprise software running millions of businesses and organizations all around the universe. 

If you want to install a different Java version on Ubuntu OS you can use the simple apt install command like this, first, you can find the Java version you want:

sudo apt search openjdk

And then install the package which JDK version you want that is listed on the list for example I want to install the 11th version like this:

sudo apt-get install openjdk-11-jdk

How To Switch Java Version

You can have multiple Java in your virtual machine, Ubuntu, or any other Linux operating system. And then if you want, you can then switch your Java version using the following Linux command.

sudo update-alternatives --config java

After that, it shows you the existing Java in your OS, if you have multiple of it, you answer the prompt by selecting the Index number on the Java version you want to use globally on your OS.

If you only have one version the command will show you a notice telling you Nothing to configure.

Popular posts from this blog

ERROR 1348 Column Password Is Not Updatable When Updating MySQL Root Password

Spring Kafka - how to use ReplyingKafkaTemplate send and reply synchronously

How To Connect SSH Using PEM Certificate On Windows

Upload and Download Rest API using Spring Boot Reactive WebFlux

MIME Types - Complete List