Java 使找不到tools.jar
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18277504/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Make cannot find tools.jar
提问by Roy Hinkley
Running Ubuntu 12.04
运行 Ubuntu 12.04
I have added to PATH: /home/jeffrey/jdk1.6.0_43/lib
我已添加到 PATH: /home/jeffrey/jdk1.6.0_43/lib
I am attempting to build from source using Make:
我正在尝试使用 Make 从源代码构建:
make -j16
But encounter the error:
但是遇到错误:
build/core/config.mk:268: *** Error: could not find jdk tools.jar, please install JDK6, which you can download from java.sun.com. Stop.
Can anyone explain to me why Make cannot find tools.jar?
谁能向我解释为什么 Make 找不到tools.jar?
EDIT
编辑
JAVA_HOME=/home/jeffrey/jdk1.6.0_43/bin/java
Determined by entering envcommand into the shell. Furthermore, this is set for all users in the etc/profile
通过env在 shell 中输入命令来确定。此外,这是为所有用户设置的etc/profile
Additionally:
此外:
jeffrey@jeffrey-Satellite-M645:~/WORKING_DIRECTORY$ java -version
java version "1.6.0_43"
Java(TM) SE Runtime Environment (build 1.6.0_43-b01)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01, mixed mode)
jeffrey@jeffrey-Satellite-M645:~/WORKING_DIRECTORY$
采纳答案by Roy Hinkley
Setting the ANDROID_JAVA_HOMEenvironment variable to JDK path, fixes this error.
将ANDROID_JAVA_HOME环境变量设置为 JDK 路径,修复了这个错误。
I found the answer with this SO post.
我在这篇 SO post 中找到了答案。
回答by Evgeniy Dorofeev
Make sure that JAVA_HOME env variable is set to jdk-install-dir
确保 JAVA_HOME 环境变量设置为 jdk-install-dir
回答by Varun Bhatia
Usually, this is caused by javac is not configured as a alternative for system. So there is no link of /usr/bin/javac for your javac.
通常,这是由于 javac 没有配置为 system 的替代方案造成的。因此,您的 javac 没有 /usr/bin/javac 的链接。
Please setup the alternative for javac using the following command:
请使用以下命令为 javac 设置替代方案:
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_32/bin/javac" 1
note: the installed directory of javac for me is "/usr/lib/jvm/jdk1.6.0_32/", you can change it by your configuration.
注意:我的javac安装目录是“/usr/lib/jvm/jdk1.6.0_32/”,可以根据自己的配置修改。

