一、mac先安装jdk环境
记得得安装稳定版本得jdk环境
(使用以下命令可知道jdk的安装路径在哪
/usr/libexec/java_home -V
Matching Java Virtual Machines (1):
1.8.0_251, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home
)
如果之前安装得jdk环境较新,可以用以下命令卸载
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencesPanes/JavaControlPanel.prefPane
sudo rm -fr ~/Library/Application\ Support/Java
然后从finder中进入 /Library/Java/JavaVirtualMachines,然后删除jdk1.8.xxx,即可