在 Windows 上为 Ant 设置 Java 路径 [英] Setting Java path on Windows for Ant

查看:40
本文介绍了在 Windows 上为 Ant 设置 Java 路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚刚下载了最新版本的 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:

Ant 和 Eclipse

但它没有解决这个具体问题.

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 路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆