ubuntu 下 切换多个jdk版本

执行下面的命令即可切换
sudo update-alternatives --config java

命令执行效果如下(依据安装的jdk数量会有不同):

jack@jack-7560:~$ sudo update-alternatives --config java
[sudo] password for jack: 
There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-14-openjdk-amd64/bin/java      1411      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      manual mode
  2            /usr/lib/jvm/java-14-openjdk-amd64/bin/java      1411      manual mode
  3            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

Press <enter> to keep the current choice[*], or type selection number: 
posted @ 2020-12-28 15:57  心如止水-杜  阅读(350)  评论(0编辑  收藏  举报
技术文章,欢迎转载,转载请注明出处。 杜鹤飞的技术博客 邮箱地址:dhf327@163.com