ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Santanu Basu <>
Subject Re: Ant not respecting JAVA_HOME
Date Mon, 22 Aug 2011 13:07:02 GMT
Have you done this?

C:\Users\Brian>cd C:\AntTest
C:\AntTest>set JAVA_HOME=C:\Program Files\Java\jdk.1.6.0_23
C:\AntTest>set ANT_HOME=C:\Program Files\Apache Software 

The above should work. Which version of Ant you are using?


Brian FitzGerald <>
Ant Users List <>
08/22/2011 06:06 PM
Re: Ant not respecting JAVA_HOME

Thank you for the response, Santanu.

> Do you have the build.xml in the directory from where you are running 
> How you are calling ant?

I didn't before, but since you mentioned it I grabbed a simple hello world
build file and put that in a directory called C:\AntTest  -- I am calling
Ant from the Window command line by navigating to the AntTest directory 
then typing the "Ant" command.

> You can create a script and set the java_home just before calling
> %ANT_HOME%/bin/ant.

Do you mean I can set the JAVA_HOME variable within the build.xml?  Or 
a command each time I run the script?  I have tried setting JAVA_HOME
immediately before running the Ant command in the Windows command line but
got the same result.

>The ANT_HOME should be C:\Program Files\Apache Software
>and not C:\Program Files\Apache Software Foundation\apache-ant-1.8.2\bin
>Try putting jdk.1.6.0_23 and apache-ant-1.8.2 in a folder which does
not contain spaces.

Sorry, I mistyped the ANT_HOME path in the original post, I actually had 
path set correctly.  Regardless, I have gone ahead and moved Ant to a
directory with no spaces as you suggested: C:\Ant and changed the ANT_HOME
environment variable accordingly.  I did not move the jdk because I'm a
little concerned that other apps are using it and I'm gonna mess something
up (kinda new at this).

So anyway, now when I run the build (with the build.xml in place), I get:

C:\Users\Brian>cd C:\AntTest
Unable to locate tools.jar. Expected to find it in C:\Program
Buildfile: C:\AntTest\build.xml

     [echo] Hello, World

Total time: 0 seconds

Buttom line: Ant is still looking in the wrong directory for Java (jre
instead of jdk).  Any idea what I could be doing wrong?


Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message