You can check the default Java, with:

java -version java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)

If you have multiple Java versions installed on the server you can change the default version using the alternatives system utility:

sudo alternatives --config java

The output should look similar to the following:

There are 4 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
   1           /usr/java/jdk1.8.0_162/jre/bin/java
   2           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/bin/java)
   3           java-1.7.0-openjdk.x86_64 (/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.171-2.6.13.0.el7_4.x86_64/jre/bin/java)
*+ 4           /usr/java/jdk-9.0.4/bin/java

Enter to keep the current selection[+], or type selection number: 

To change the default Java version, just enter the number when prompted and hit Enter.

One thought on “Make the Default Java Verson

Leave a Reply

Your email address will not be published. Required fields are marked *