Change Java version on Linux

Suppose you are working in a Linux system with multiple Java versions installed. So how to change the version of Java from this version to another version, this tutorial will guide you to do it!

For example, I’m using Ubuntu, and my Ubuntu is installing two versions of Java, namely:

  • Java 6 Update 38
  • Java 7 Update 95

By default, I’m using Java 7 Update 95, you can use the java -version command to test this.

Now, I want to use the Java 6 Update 38, I will use command update-alternatives on Ubuntu and do the following:

In this step, if you change your mind, still want to use the current version of Java, press Enter, nothing changes.

I want to switch to Java version 6 Update 38 so I will choose 2 and press Enter. A message will be displayed informing you that the conversion was successful:

Result:

Add Comment