Wednesday, July 4, 2018

Choose JVM / Java Version in Ubuntu

Choose JVM Version while running an application in Ubuntu. 
Assumption: There are multiple JVM versions installed in system and for few processes we want JDK1.7, for few we want JDK1.8.

Ubunut$   update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).  
 
  Selection    Path                                            Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      auto mode
  1            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode
  2            /usr/lib/jvm/jdk1.8.0_161/bin/java               1         manual mode
  3            /usr/lib/jvm/jdk1.7.0_160/bin/java               1         manual mode

Press <enter> to keep the current choice[*], or type selection number:  3   Press Enter (For using JDK1.7)