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 11:56:20 GMT
Do you have the build.xml in the directory from where you are running ant?
How you are calling ant?

You can create a script and set the java_home just before calling 

set JAVA_HOME=C:\Program Files\Java\jdk.1.6.0_23
set ANT_HOME=C:\Program Files\Apache Software Foundation\apache-ant-1.8.2

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 running this from the command prompt.

Sometimes spaces in the directory names might create problems, also try 
putting jdk.1.6.0_23 and apache-ant-1.8.2 in a folder which does not 
contain spaces.


Brian FitzGerald <>
08/22/2011 03:08 PM
Ant not respecting JAVA_HOME

I have set JAVA_HOME and ANT_HOME environment variables as well as adding
%JAVA_HOME%\bin and %ANT_HOME\bin to the PATH environment variable.

When I echo JAVA_HOME, I get the value I expect:
C:\Program Files\Java\jdk.1.6.0_23

When I echo ANT_HOME I get the value I expect:
C:\Program Files\Apache Software Foundation\apache-ant-1.8.2\bin

However when I run Ant, I get:
Unable to locate tools.jar (because it is looking in C:\Program 
Buildfile: build.xml does not exist!
Build failed

So even though JAVA_HOME appears to be set correctly as an environment
variable, Ant is still looking at the jre rather than the jdk.  So it 
as if my JAVA_HOME is being overwriten or Ant is ignoring it.  Any 
how I can fix this?


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