How to unable to locate tools. jar when Apache ant is running

Source: Internet
Author: User

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.

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.