Download Apache ant
1. Unzip the ant installation package under D: \ ant.
II. Environment Variable Configuration
Ant_home D :\ant \ apache-ant-1.9.0
Classpath; % ant_home % LIB;
Path; % Ant_home % bin;
Iii. test whether the installation is successful
Run the CMD command: ant-version
Problem:
1) unable to locate tools. Jar. Expected to find it in c: \ Program Files \ Java \ jre6 \ Lib
The command line prompts "unable to locate tools. Jar. Expected to find it in c: \ Program Files \ Java \ jre6 \ Lib" after hitting the ant command ";
The ant_home environment variable has been configured;
Solution: Set the tools in the "C: \ Program Files \ Java \ jdk1.6.0 _ 16 \ Lib" directory. copy the JAR file to the "C: \ Program Files \ Java \ jre6 \ Lib" directory and run the ant command again. The problem is solved.
2) Enter ant in the CMD command. If the output is: buildfile: Build. XML does not exist!
Build failed
It indicates that ant is successfully installed.
PS: Tools. jar is in lib under JDK. Let's talk about the differences between JDK and JRE: JRE is the runtime environment and the compiled JavaProgramYou only need to run JRE. JDK is the development environment. You need to use JDK when developing Java programs. JDK includes JRE, and Java programs run with JRE or JDK, but JDK includes the tools required during development. If you only run the Java program, you only need to run the JRE, because the JRE saves more space than the JDK. When configuring the Java environment, I usually add the D: \ jdk6 \ bin directory directly to the environment variable, which can meet the requirements of the Java compiling environment. However, when ant needs tools. jar, it is best to configure environment variables:
Java_home = c: \ Program Files \ Java \ jdk1.6.0 _ 10 classpath =.; % java_home % \ Lib \ tools. Jar
In this way, there will be no problems when running the ant Compilation Program.