执行下面的命令即可切换
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: