如何在 Windows 下设置 ANT_HOME?
Windows下如何轻松设置ANT_HOME?我添加了“D:\Installz\apache-ant-1.8.2\bin;”添加到我的系统环境变量 PATH 中,我还创建了一个 ANT_HOME 变量。
How can I easily set ANT_HOME under Windows? I added "D:\Installz\apache-ant-1.8.2\bin;" to my system environment variable PATH and I also created an ANT_HOME variable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
在 Windows 7 中,您可以转到
控制面板\所有控制面板项\系统
或右键单击计算机,然后转到“高级系统设置”
D:\Installz\apache-ant-1.8.2
)如果其中没有“路径”变量,请再次单击新建按钮
或
选择它并通过添加值进行编辑:
%ANT_HOME%\bin;
ant -version
In Windows 7 you can go to
Control Panel\All Control Panel Items\System
or right click on Computer and then to“Advance system setting”
D:\Installz\apache-ant-1.8.2
)Either click again on New button if you do not have ‘Path’ Variable in there
OR
Select it and edit by adding the value :
%ANT_HOME%\bin;
ant -version
我希望您在 Windows 上运行(因为您使用的是
%
)。只需添加一个新的环境变量(右键单击“我的电脑”>“属性”>“高级”>“环境变量”)或使用命令行使用
SET ANT_HOME=
(在这种情况下,它将仅在该命令行上处于活动状态)。设置完成后,您应该能够通过在命令行中执行
echo %ANT_HOME%
来验证其值。变量周围的 % 符号表示它是一个环境变量。
对于 Linux,请在命令行或 ~/.profile 中使用
export ANT_HOME=
(持久,需要注销/登录)。使用echo $ANT_HOME
进行验证。I expect you to be running on Windows (since you are using
%
).Simply add a new environment variable (Right-click on My Computer > Properties > Advanced > environment Variable) or using
SET ANT_HOME=<path>
using command line (in that cas, it will only be active on that command line).Once set you should be able to verify its value by doing
echo %ANT_HOME%
in command lineThe % sign around the variable indicates it is an environment variable.
For linux use the
export ANT_HOME=<path>
in command line or in your ~/.profile (persistent, require logout/login). Useecho $ANT_HOME
for verification.我在安装JAVA JDK & 时遇到了类似的问题。蚂蚁。
我尝试用这种方式安装JDK。
甲骨文网站 -->下载JDK安装程序 -->双击安装文件(在桌面上)-->接受所有默认值 -->结束。
我们需要在部署系统中设置环境变量。
我的电脑(右键单击)-->属性-->高级设置-->环境变量-->系统变量-->添加新的 -->变量名:JAVA_HOME,变量路径:你电脑上jdk的安装路径 -->点击确定,好的。
检查Java是否安装成功。
窗口 + R --> cmd--> Java版本
您将看到如下响应
C:\Users\PRAX>java -version
java版本“1.6.0_38”
Java(TM) SE 运行时环境(版本 1.6.0_38-b05)
Java HotSpot(TM) 64 位服务器 VM(内部版本 20.13-b02,混合模式)
这表明您已成功安装 JDK 和 Java HotSpot(TM) 64 位服务器 VM(内部版本 20.13-b02,混合模式)也设置一个环境变量。
ANT安装:
从http://ant.apache.org/bindownload下载ant文件.cgi
选择一面镜子&下载 zip(zip 是最简单的设置方法)
将文件解压到您的计算机上 -->复制路径(遍历到bin文件夹)。
现在,我们需要设置一个环境变量,
命令-->设置ANT_HOME=安装路径-->按回车键
如果你输入正确,它不会抛出任何错误。
现在执行,回显%ANT_HOME%
您将看到结果作为您的安装路径。
你的工作完成了。
执行上述设置后,默认情况下甚至可以在计算机属性中检查环境变量。
希望,有用。
I had a similar problem of installing JAVA JDK & ANT.
I tried installing JDK this way.
Oracle site --> download JDK setup --> double click on the set up file (on your desktop) --> accept all defaults --> finish.
we need to set environment variable in the deployment system.
mycomputer (right click) --> properties --> advanced settings --> Environment variable --> system variable --> add new --> variable name: JAVA_HOME, Variable path: installation path of jdk on you computer --> click ok, ok.
To check the successful installation of Java .
windows + R --> cmd --> Java -Version
you would see the response as below
C:\Users\PRAX>java -version
java version "1.6.0_38"
Java(TM) SE Runtime Environment (build 1.6.0_38-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.13-b02, mixed mode)
This shows that you have successfully installed JDK & set an environment variable too.
ANT installation:
download ant file from http://ant.apache.org/bindownload.cgi
choose a mirror & download the zip (zip is the easiest method to set)
unzip the file on your computer --> copy the path (traverse till bin folder).
Now, we need to set an environment variable,
Cmd --> set ANT_HOME = installation path --> press Enter
if you have correctly entered, it wont throw any error.
now execute, echo %ANT_HOME%
you would see the result as your installation path.
your work is done.
you can check the environment variable even in computer properties by default after executing the above set up.
Hope, its useful.
ANT_HOME 是 ant 安装目录的路径,在您的情况下为“D:\Installz\apache-ant-1.8.2”
JAVA_HOME 是 java 安装目录,例如“C:\Program Files\Java\jdk1.7.0”,在我的机器上。
在 Windows 上,%%(百分比)符号用于表示变量。
因此,要设置这两个变量,您可以
在命令提示符中执行此操作,仅对特定命令提示符的会话有效
,或者
转到系统属性->高级->环境变量并设置为新变量
ANT_HOME is the path to your ant installation dir, in your case "D:\Installz\apache-ant-1.8.2"
and JAVA_HOME is java install dir e.g. "C:\Program Files\Java\jdk1.7.0", that's on my machine
On Windows, %% (percent) symbols are used to signify variables.
so to set both variables you can do either
in command prompt, only valid for the session of the particular command propmt
or
go to System Properties -> Advanced -> Environment Variables and set to new variables
更灵活的解决方案是在启动 ant 脚本的批处理文件中执行所有“环境内容”,当没有更改环境变量的权限时也可以使用。
请参阅 最近出现的类似问题以了解详细信息。
A more flexible solution is to do all that 'environment stuff' in a batch file that starts your ant script, works also when there are no rights to change the environment variables.
See a similar question that came up recently for details.
我在配置 ANT 时遇到了类似的问题。
我尝试以这种方式配置 ANT。
首先将最新版本的 apache-ant (apache-ant-1.10.14) 添加到 JAVA 目录的同一目录中。
然后转到 env(编辑系统环境变量)>高级>环境变量,在这里您需要单击“新建”并将名称定义为“ANT_HOME”,然后放置您离开 apache-ant zip 文件夹的目录并保存。
最后一步是双击 ANT_HOME 同一列中的路径,打开后然后单击其中一个空闲行并添加此方向“ %ANT_HOME%\bin ”
然后一切就完成了,你可以保存步骤。
测试:转到命令行并输入“ant”,如果出现“
构建文件:build.xml 不存在
构建失败
”
那么就意味着一切都好!
如果没有再次检查步骤。
I had a similar problem of Configuring ANT.
I tried to configure ANT this way.
first add the last version of apache-ant (apache-ant-1.10.14) in the same dir of the JAVA dir.
then go to env (Edit the System Environment Variable) > Advanced > Environment Variable and here you need to click on New and Define the name as " ANT_HOME " and put the dir which you left the apache-ant zip folder and save.
the last step is double click on path which is in a same column of ANT_HOME, when it is opened then click in one of the free lines and add this direction " %ANT_HOME%\bin "
then all done and you can just save the steps.
for test: go to Command Line and type "ant", if you get "
Buildfile: build.xml does not exist
Build failed
"
then it means all good!
if not check the steps again.