![如何在 ubuntu 18.04 上安装 Oracle JDK 14 并让 java 应用程序使用它?](https://linux22.com/image/1017504/%E5%A6%82%E4%BD%95%E5%9C%A8%20ubuntu%2018.04%20%E4%B8%8A%E5%AE%89%E8%A3%85%20Oracle%20JDK%2014%20%E5%B9%B6%E8%AE%A9%20java%20%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E4%BD%BF%E7%94%A8%E5%AE%83%EF%BC%9F.png)
答案1
使用以下命令轻松安装 .deb 文件gdebi-gtk
现在,下面,注意路径,jdk-14.0.1
可能会有所不同:
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-14.0.1/bin/java 2
sudo update-alternatives --config java # select it now
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-14.0.1/bin/javac 2
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk-14.0.1/bin/jar 2
sudo update-alternatives --set javac /usr/lib/jvm/jdk-14.0.1/bin/javac
sudo update-alternatives --set jar /usr/lib/jvm/jdk-14.0.1/bin/jar
java -version;javac -version #confirm it
根据以下信息: https://websiteforstudents.com/how-to-manually-install-oracle-java-14-on-ubuntu-18-04-16-04/