1.查找java安装位置
/usr/libexec/java_home -V
#Matching Java Virtual Machines (2):
1.8.311.11 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
1.8.0_251 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
把/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home/lib文件夹下的tools.jar 复制给这个文件 /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib
sudo cp /Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home/lib/tools.jar /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib