Windows Apache ant installation, environment variable configuration tutorial _java

Source: Internet
Author: User

First, install Ant
Go to the official homepage http://ant.apache.org Download the new version (currently Ant1.8.1) ant, get a apache-ant-1.8.1-bin.zip compression package. Unzip it to your hard drive, for example: C:\apache-ant-1.8.1.

Second, configure environment variables

Setting ant environment Variables in window:

Ant_home c:/apache-ant-1.8.1

Path c:/Apache-ant-1.8.1/bin

Classpath C:/apache-ant-1.8.1/lib

Note: "
Configure environment variables: My Computer----Properties-----Advanced----Environment Variables
such as: ant_home:c:\apache-ant-1.8.1
Path:%ant_home%\bin (for ease of operation in DOS environment)
Experiment has always failed, no way to change the address c:/Apache-ant-1.8.1/bin, and no longer use the variable ... It worked..

Third, verify Ant

To verify that ant is installed successfully, you can do the following:

Select: Start-> run->cmd, enter the following command: Ant

If the following occurs, the installation is successful:

Copy Code code as follows:

Buildfile:build.xml does not exist!

Build failed

"Indicates that the ant installation was successful!" Because ant runs the Build.xml file by default, this file needs to be set up for us. 】

View version: Ant-version

However, if the following occurs, the installation fails: (You can repeat the preceding steps until the installation succeeds.) )

' Ant ' is not an internal or external command, it is not a running program or a batch file.

Moving over from elsewhere:

Use:
(1) Establishment of Build.xml in D-Packing directory

Copy Code code as follows:

<?xml version= "1.0" encoding= "GBK"?>
<project name= "test Script" default= "CopyFile" basedir= "." >
<target name= "CopyFile" >
<copy file= "D:/a.txt" todir= "E:/temp" overwrite= "true"/>
</target>
</project>

(2) Establish the file A.txt in the D packing directory.
(3) Enter DOS,
D:
Ant

At this point in the E:/temp directory to see the file Aa.txt, content and a.txt the same, that is, copy success!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.