Switch JDK Version Linux Guide

Switching JDK versions on Linux can be done through the following steps:

  1. To begin, use the following command to check the installed Java version in the system:
java -version
  1. If there are multiple JDK versions installed in the system, you can use the following command to view the installed JDK paths:
update-alternatives --config java
  1. Based on the output of the above command, select the JDK version number to switch to and make a note of it.
  2. Switch the JDK version with the following command:
sudo update-alternatives --config java
  1. A list will appear shortly, showing the available JDK versions. Input the number of the JDK version you want to switch to, and press Enter.
  2. Use the following command to verify if the JDK version has been successfully switched:
java -version

By following the steps above, you can switch JDK versions on Linux.

bannerAds