问题描述
只需下载最新版本的Ant并安装在以下位置:
Just downloaded the latest version of Ant and installed at:
C:\apache-ant-1.8.4
我在Env Path变量中添加了以下内容:
I added the following to the Env Path variable:
...;C:\apache-ant-1.8.4\bin
当我打开一个终端窗口并键入:
When I open a terminal window and type:
ant -version
我得到:
Files\Java\jdk1.7.0_07"" was unexpected at this time.
在系统变量中,我将变量JAVA_HOME设置为:
In System variables I have the variable JAVA_HOME set to:
"C:\Program Files\Java\jdk1.7.0_07"
因此,"ant -version"似乎很难读取JAVA_HOME中的空格,即使它用引号引起来也是如此.
so it appears that "ant -version" is struggling to read the space in JAVA_HOME even though it is in quotes.
我看到有关该主题的另一篇文章:
I see an alternative post on this topic:
但是它不能解决这个特定问题.
but it doesn't tackle this specific point.
还有其他人遇到此问题并知道答案吗?
Has anyone else encountered this problem and know the answer?
推荐答案
我的猜测是,JAVA_HOME的当前定义中有不需要的双引号.在命令窗口中显示set JAVA_HOME
的输出.它不应包含任何双引号.
My guess is current definition of JAVA_HOME has unwanted double quotes. Show output of set JAVA_HOME
on command window. It should not have any double quotes.
请启动命令提示符.再次设置JAVA_HOME
Please start command prompt. Set the JAVA_HOME again
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_07
这篇关于在Windows上为Ant设置Java路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!