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 
%ANT_HOME%/bin/ant.

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
%ANT_HOME%\bin\ant

The ANT_HOME should be C:\Program Files\Apache Software 
Foundation\apache-ant-1.8.2 
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.

Thanks,
Santanu



From:
Brian FitzGerald <bmfitzgera...@gmail.com>
To:
user@ant.apache.org
Date:
08/22/2011 03:08 PM
Subject:
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 
Files\Java\*
jre6*\lib\tools.jar)
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 
seems
as if my JAVA_HOME is being overwriten or Ant is ignoring it.  Any 
thoughts
how I can fix this?

Thanks,
Brian


=====-----=====-----=====
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


Reply via email to