Mac卸载java解决安装最新版java SE报错Unable to locate an executable at “/Library/Java/JavaVirtualMachines/jdk-1

操作系统:
Mac Catalina version 10.15.1
搭建java环境时不能安装最新jdk,否则使用
sudo apt install 软件的时候会提示:
Unable to locate an executable at “/Library/Java/JavaVirtualMachines/jdk-14.0.2.jdk/Contents/Home/bin/apt” (-1)
解决方法:
卸载本机目前安装的java,重新更换jdk版本

sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin 
sudo rm -fr/Library/PreferencesPanes/JavaControlPanel.prefpane```
查询本机jdk版本:
ls /Library/Java/JavaVirtualMachines/ 
删除:
#这里的jdk版本是14.0.2
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-14.0.2.jdk

你可能感兴趣的:(Mac,java,jdk,jre,mac,os,x)