How to set default Java version?
We have multiple java version installed in to the system like 1.7, 1.8 or 11 but my application need java 11 as default JAVA so how can i set the default java version 11 for the system ?
Here is the solution to set the default version of java using
1 - first check the existing java version
java -version
Here we have java 1.8 as default java version, so in that case we will change the default java version using below command
sudo update-alternatives --config java
Note: (+) is representing the java version
In the above output we can see the default java version java-1.8.0-openjdk.x86_64,
To change the default java version we will type number 1 for java-11 and press the enter key
Verify
java -version
I hope this topic gave you all the information you needed. If you have any further questions or would like more detailed directions feel free to contact us using any of the following sources.We look forward to talking to you.