问题描述
在运行ant,我得到以下信息:
When running ant, I get the following message:
无法找到tools.jar中。预计将发现它在C:\\ Program Files文件\\的Java \\ JRE6 \\ lib目录\\ tools.jar中
我JAVA_HOME设置为 C:\\ Program Files文件\\的Java \\ jdk1.7.0_02
,路径包括 C:\\ Program Files文件(86) \\的Java \\ jdk1.7.0_02 \\ BIN
,CLASSPATH包括 C:\\ Program Files文件(x86)的\\的Java \\ jdk1.7.0_02
和ANT_HOME设置为 C:\\蚂蚁
I have JAVA_HOME set to C:\Program Files\Java\jdk1.7.0_02
, PATH includes C:\Program Files (x86)\Java\jdk1.7.0_02\bin
, CLASSPATH includes C:\Program Files (x86)\Java\jdk1.7.0_02
, and ANT_HOME is set to C:\ant
.
好像蚂蚁忽略所有的这些设置和寻找的tools.jar别的地方。有没有环境变量,指向JRE6路径。任何想法,为什么?
It seems that ant is ignoring all of these settings and looking for the tools.jar somewhere else. There are no environment variables which point to the jre6 path. Any ideas why?
推荐答案
有两个目录,看起来像JDK。
There are two directories that looks like JDK.
C:\Program Files\Java\jdk1.7.0_02
C:\Program Files (x86)\Java\jdk1.7.0_02\
要同时安装了64位和32位JDK这可能是由于?以往可能是什么的情况下,的java.exe
以看到的 ant.bat 从JDK应该。如果JRE的的java.exe
至上的路径,这将被用来猜测JDK位置。
This may be due to both 64 bit and 32 bit JDK installed? What ever may be the case, the java.exe
seen by ant.bat should from the JDK. If the JRE's java.exe
comes first in the path, that will be used to guess the JDK location.
把'C:\\ Program Files文件(x86)的\\的Java \\ jdk1.7.0_02 \\ BIN或C:\\ Program Files文件\\的Java \\ jdk1.7.0_02'。如在路径的第一个参数
Put 'C:\Program Files (x86)\Java\jdk1.7.0_02\bin' or 'C:\Program Files\Java\jdk1.7.0_02' as the first argument in the path.
另外的步骤:
您可以采取蚂蚁-diagnostics
的输出,并寻找有趣的钥匙。 (假设太阳/ Oracle的JDK)。
You can take output of ant -diagnostics
and look for interesting keys. (assuming Sun/Oracle JDK).
java.class.path
java.library.path
sun.boot.library.path
(中出现的tools.jar在java.class.path我的情况)
(in my case tools.jar appears in java.class.path)
这篇关于"无法找到的tools.jar"运行时,蚂蚁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!