[英]Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-7-openjdk-amd64/lib/tools.jar
I'm trying to build a project using ant but I keep receiving this error on issuing ant clean
: 我正在尝试使用ant构建一个项目但是我在发出ant clean
一直收到这个错误:
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-7-openjdk-amd64/lib/tools.jar
I've tried to change JAVA_HOME to point to JDK and exported PATH variables, but still to no avail. 我试图将JAVA_HOME更改为指向JDK并导出PATH变量,但仍无济于事。 Here's what they look like: 这是他们的样子:
export PATH="/usr/local/heroku/bin:$PATH"
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
Here's what my /etc/environment file looks like: 这是我的/ etc / environment文件的样子:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/$
JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"
As mentioned by OscarGz in the comment, you should be able to find your answer in Ant needs tools.jar and unable to find it . 正如OscarGz在评论中所提到的,你应该能够在Ant needs tools.jar中找到你的答案而无法找到它 。
Short summary: Install the JDK (Java Development Kit) with the matching version. 简短摘要:使用匹配版本安装JDK(Java Development Kit)。 In Debian-based systems, the package may be called openjdk-7-jdk
(or later versions). 在基于Debian的系统中,包可以称为openjdk-7-jdk
(或更高版本)。 You might also need to set the Java version which is actually used by invoking the update-alternatives
tool for java and javac: 您可能还需要通过调用java和javac的update-alternatives
工具来设置实际使用的Java版本:
update-alternatives --config javac
update-alternatives --config java
Manually setting environment variables should then not be necessary. 然后,不需要手动设置环境变量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.