CrazyAirhead

疯狂的傻瓜,傻瓜也疯狂——傻方能执著,疯狂才专注!

0%

如何处理无法找到tool.jar问题

问题

macOS Big Sur系统,使用Gralde在Terminal编译时,提示Could not find tool.jar. Please check that /library/internet plug-ins/javaappletplugin.plugin/contents/home contains a valid jdk installation.

原因

未配置JAVA_HOME,编译时找到了JRE的目录,而JRE目录则不包含tool.jar。

方法

  1. 使用/usr/libexec/java_home -V查看JDK目录
1
2
3
4
5
/usr/libexec/java_home -V
Matching Java Virtual Machines (2):
1.8.211.12 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
1.8.0_211 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Homes
  1. 设置JAVA_HOME
1
2
3
vim ~/.zshrc

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home

参考链接

MACBOOK(OSX)最升到11.0.1后android 打包报错 Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.

欢迎关注我的其它发布渠道