【发布时间】:2014-09-22 14:48:54
【问题描述】:
我一直在尝试在我的 Windows 7 机器上设置 Cordova。经过数小时的故障排除后,我相信我已将问题缩小到 ant 的配置,但我不知道如何解决它。
在提示符下执行cordova build 时,在-compile: 下我得到:
BUILD FAILED
C:\path\to\ant\build.xml:601: The following error occurred while executing this line:
C:\path\to\ant\build.xml:720: The following error occurred while executing this line:
C:\path\to\ant\build.xml:734: Unable to find javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME_ does not point to the JDK.
It is currently set to "C:\Program Files(x86)\Java\jre1.8.0_20"
现在令人沮丧的是,在我的环境变量中 JAVA_HOME 确实指向 JDK 而不是 JRE。当我运行set JAVA_HOME 时,我得到:
JAVA_HOME=C:\Program Files(x86)\Java\jdk1.8.0_20
当我运行echo %JAVA_HOME% 时,我得到:
C:\Program Files(x86)\Java\jdk1.8.0_20
这是我所有相关的环境变量(我认为):
ANT_HOME: C:\ant
JAVA_HOME: C:\Program Files(x86)\Java\jdk1.8.0_20
路径:C:\Program Files (x86)\nodejs\;C:\Program Files (x86)\Git\bin;C:\Development\adt-bundle\sdk\platform-tools;C:\Development\ adt-bundle\sdk\tools;C:\Program Files (x86)\Java\jre1.8.0_20\bin;C:\Program Files(x86)\Java\jdk1.8.0_20\bin;C:\Users\Casey Ydenberg\AppData\Roaming\npm;C:\ant\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
有什么建议可以尝试吗?
谢谢你, 凯西
【问题讨论】:
-
从命令行运行
echo %JAVA_HOME%。它输出什么? -
见上面的编辑。 echo %JAVA_HOME% 输出:
C:\Program Files(x86)\Java\jdk1.8.0_20.