You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Brian FitzGerald <bm...@gmail.com> on 2011/08/22 11:36:48 UTC

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

Re: Ant not respecting JAVA_HOME

Posted by Santanu Basu <sa...@tcs.com>.
Brian,

you can try this as well

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:\Ant
C:\AntTest>set path=%JAVA_HOME%\bin
C:\AntTest>java -classpath "%ANT_HOME%\lib\ant-launcher.jar" 
-Dant.home=c:\ant org.apache.tools.ant.launch.Launcher

Thanks,



From:
Brian FitzGerald <bm...@gmail.com>
To:
Ant Users List <us...@ant.apache.org>
Date:
08/22/2011 07:28 PM
Subject:
Re: Ant not respecting JAVA_HOME



Thanks for the help guys... this is what I got:

WITH QUOTES:
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:\Ant"
C:\AntTest>%ANT_HOME%\bin\ant
The syntax of the command is incorrect.

WITHOUT QUOTES:
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:\Ant
C:\AntTest>%ANT_HOME%\bin\ant
Unable to locate tools.jar. Expected to find it in C:\Program
Files\Java\jre6\li
b\tools.jar
Buildfile: C:\AntTest\build.xml

hello:
     [echo] Hello, World

BUILD SUCCESSFUL
Total time: 0 seconds

So with quotes it wouldn't run at all.  Without quotes, it ran, but still 
is
looking in the JRE directory.  Is now a good time to start banging my head
against the wall?

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



Re: Ant not respecting JAVA_HOME

Posted by an...@quantel.com.
Brian FitzGerald <bm...@gmail.com> wrote on 22/08/2011 15:42:29:

> When I wrap the variable and value with quotes as Parag suggested it 
runs
> the build but still looks for Java in the jre directory.
> 

What I do is have a build.bat file that contains something like the 
following.
I don't have any spaces in paths, so you may need to add the quotes if you
do.


@echo off
SetLocal

set ROOT=C:\
set LIB=%ROOT%\Libs
set ANT_ROOT=%LIB%\ant
set JAVA_ROOT=%LIB%\Java

set ANT_HOME=%ANT_ROOT%\latest
set JAVA_HOME=%JAVA_ROOT%\latest

echo Setting up CLASSPATH
set CLASSPATH=%JAVA_HOME%\lib\tools.jar
set CLASSPATH=%CLASSPATH%;%ANT_HOME%\lib\ant.jar
set CLASSPATH=%CLASSPATH%;%ANT_HOME%\lib\ant-launcher.jar
echo.
echo CLASSPATH=%CLASSPATH%
echo.

set action=all
IF not "x%1" == "x" set action=%1
echo.
echo Ant action: %action%
echo.

%JAVA_HOME%\bin\java "-Dant.home=%ANT_HOME%" -ea org.apache.tools.ant.Main 
%action% %2 %3 %4 %5 %6

I then run ant by calling build.bat "target"

Hope that helps

Andy Ling

-- 

This e-mail is intended for the named addressees only. Its contents may be 
privileged or confidential and should be treated as such. If you are not 
an intended recipient please notify the sender immediately and then delete 
it;  do not copy, distribute, or take any action based on this e-mail. In 
the pursuit of its legitimate business activities and its conformance with 
relevant legislation, Quantel may access any e-mail (including 
attachments) it originates or receives, for potential scrutiny. 

Quantel is the trade name used by Quantel Holdings Limited and its 
subsidiaries.  Quantel Holdings Limited is registered in England & Wales. 
Registration No: 4004913 
Contact details for all Quantel Offices and Companies can be found on our 
website www.quantel.com or by writing to the holding company.
Registered address: Turnpike Road, Newbury, Berkshire, RG14 2NX, United 
Kingdom 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant not respecting JAVA_HOME

Posted by Brian FitzGerald <bm...@gmail.com>.
When I wrap the variable and value with quotes as Parag suggested it runs
the build but still looks for Java in the jre directory.

I commented out the echo off line as suggested and this was the output (hope
it's not too annoying that I post the whole thing):

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:\Ant

C:\AntTest>%ANT_HOME%\bin\ant

C:\AntTest>REM @echo off

C:\AntTest>REM  Licensed to the Apache Software Foundation (ASF) under one
or more

C:\AntTest>REM  contributor license agreements.  See the NOTICE file
distributed with

C:\AntTest>REM  this work for additional information regarding copyright
ownership.

C:\AntTest>REM  The ASF licenses this file to You under the Apache License,
Version 2.0

C:\AntTest>REM  (the "License"); you may not use this file except in
compliancewith

C:\AntTest>REM  the License.  You may obtain a copy of the License at

C:\AntTest>REM

C:\AntTest>REM      http://www.apache.org/licenses/LICENSE-2.0

C:\AntTest>REM

C:\AntTest>REM  Unless required by applicable law or agreed to in writing,
software

C:\AntTest>REM  distributed under the License is distributed on an "AS IS"
BASIS
,

C:\AntTest>REM  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied.

C:\AntTest>REM  See the License for the specific language governing
permissions and

C:\AntTest>REM  limitations under the License.

C:\AntTest>REM This is an inordinately troublesome piece of code,
particularly because it

C:\AntTest>REM tries to work on both Win9x and WinNT-based systems. If we
could abandon '9x

C:\AntTest>REM support, things would be much easier, but sadly, it is not
yet time.

C:\AntTest>REM Be cautious about editing this, and only add WinNT specific
stuff in code that

C:\AntTest>REM only runs on WinNT.

C:\AntTest>if "" == "" goto homeDrivePathPre

C:\AntTest>if "C:\Users\Brian" == "" goto userProfilePre

C:\AntTest>if "C:\Users\Brian" == "" goto userProfilePre

C:\AntTest>if exist "C:\Users\Brian\antrc_pre.bat" call
"C:\Users\Brian\antrc_pre.bat"

C:\AntTest>if "C:\Users\Brian" == "" goto alpha

C:\AntTest>if "C:\Users\Brian" == "" goto alpha

C:\AntTest>if "C:\Users\Brian" == "C:\Users\Brian" goto alpha

C:\AntTest>if "Windows_NT" == "Windows_NT"

C:\AntTest>if "Windows_NT" == "WINNT"

C:\AntTest>if "C:\Ant" == "" goto setDefaultAntHome

C:\AntTest>if not _t == _\ goto checkClasspath

C:\AntTest>set _USE_CLASSPATH=yes

C:\AntTest>rem CLASSPATH must not be used if it is equal to ""

C:\AntTest>if ".;C:\Program Files\Java\jre6\lib\ext\QTJava.zip" == """" set
_USE_CLASSPATH=no

C:\AntTest>if ".;C:\Program Files\Java\jre6\lib\ext\QTJava.zip" == "" set
_USE_CLASSPATH=no

C:\AntTest>rem Slurp the command line arguments. This loop allows for an
unlimited number

C:\AntTest>rem of arguments (up to the command line limit, anyway).

C:\AntTest>set ANT_CMD_LINE_ARGS=

C:\AntTest>if """" == """" goto doneStart

C:\AntTest>if "yes" == "no" goto findAntHome

C:\AntTest>if not _p == _\ goto findAntHome

C:\AntTest>rem find ANT_HOME if it does not exist due to either an invalid
value passed

C:\AntTest>rem by the user or the C:\Ant\bin\ant problem on Windows 9x

C:\AntTest>if exist "C:\Ant\lib\ant.jar" goto checkJava

C:\AntTest>set _JAVACMD=

C:\AntTest>if "C:\Program Files\Java\jdk.1.6.0_23" == "" goto noJavaHome

C:\AntTest>if not exist "C:\Program Files\Java\jdk.1.6.0_23\bin\java.exe"
goto noJavaHome

C:\AntTest>if "" == "" set _JAVACMD=java.exe

C:\AntTest>if not "" == "" goto runAntWithJikes

C:\AntTest>if "yes" == "no" goto runAntNoClasspath

C:\AntTest>"java.exe"  -classpath "C:\Ant\lib\ant-launcher.jar"
"-Dant.home=C:\A
nt" org.apache.tools.ant.launch.Launcher  -cp ".;C:\Program
Files\Java\jre6\lib\
ext\QTJava.zip"
Unable to locate tools.jar. Expected to find it in C:\Program
Files\Java\jre6\li
b\tools.jar
Buildfile: C:\AntTest\build.xml

hello:
     [echo] Hello, World

BUILD SUCCESSFUL
Total time: 0 seconds

C:\AntTest>rem Check the error code of the Ant build

C:\AntTest>if not "Windows_NT" == "Windows_NT" goto onError

C:\AntTest>set ANT_ERROR=0

C:\AntTest>goto end

C:\AntTest>rem bug ID 32069: resetting an undefined env variable changes the
errorlevel.

C:\AntTest>if not "java.exe" == "" set _JAVACMD=

C:\AntTest>if not "" == "" set ANT_CMD_LINE_ARGS=

C:\AntTest>if "0" == "0" goto mainEnd

C:\AntTest>rem If there were no errors, we run the post script.

C:\AntTest>if "Windows_NT" == "Windows_NT"

C:\AntTest>if "Windows_NT" == "WINNT"

C:\AntTest>if "" == "" goto homeDrivePathPost

C:\AntTest>if "C:\Users\Brian" == "" goto userProfilePost

C:\AntTest>if "C:\Users\Brian" == "" goto userProfilePost

C:\AntTest>if exist "C:\Users\Brian\antrc_post.bat" call
"C:\Users\Brian\antrc_post.bat"

C:\AntTest>if "C:\Users\Brian" == "" goto omega

C:\AntTest>if "C:\Users\Brian" == "" goto omega

C:\AntTest>if "C:\Users\Brian" == "C:\Users\Brian" goto omega

C:\AntTest>exit /b

Thank you for any further suggestions.

Brian


2011/8/22 Parag Doke <pa...@gmail.com>

> The right syntax to include a value with spaces for batch files / cmd.exe
> is:
> set "variable=value with spaces"
> So, you should have used
> set "JAVA_HOME=C:\Program Files\Java\jdk.1.6.0_23"
>
> Not sure if this might help you original issue though. Did you try to
> comment the echo off line (precede with "rem ") in ant.bat / ant.cmd
> under ANT_HOME/bin? Maybe, if you comment that, you will see on the
> console what executable it is trying to run.
>
> Hope this helps,
> Parag Doke
> Save paper, save trees. Do not print emails/documents unless
> absolutely necessary.
>
>
>
> On Mon, Aug 22, 2011 at 7:27 PM, Brian FitzGerald
> <bm...@gmail.com> wrote:
> > Thanks for the help guys... this is what I got:
> >
> > WITH QUOTES:
> > 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:\Ant"
> > C:\AntTest>%ANT_HOME%\bin\ant
> > The syntax of the command is incorrect.
> >
> > WITHOUT QUOTES:
> > 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:\Ant
> > C:\AntTest>%ANT_HOME%\bin\ant
> > Unable to locate tools.jar. Expected to find it in C:\Program
> > Files\Java\jre6\li
> > b\tools.jar
> > Buildfile: C:\AntTest\build.xml
> >
> > hello:
> >     [echo] Hello, World
> >
> > BUILD SUCCESSFUL
> > Total time: 0 seconds
> >
> > So with quotes it wouldn't run at all.  Without quotes, it ran, but still
> is
> > looking in the JRE directory.  Is now a good time to start banging my
> head
> > against the wall?
> >
> > Brian
> >
> >
> >
> > 2011/8/22 <an...@quantel.com>
> >
> >> Santanu Basu <sa...@tcs.com> wrote on 22/08/2011 14:07:02:
> >>
> >> > 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
> >> > Foundation\apache-ant-1.8.2
> >> > C:\AntTest>%ANT_HOME%\bin\ant
> >> >
> >> > The above should work. Which version of Ant you are using?
> >> >
> >>
> >> Just to be sure, you should probably put quotes round those
> >> paths with spaces in.
> >>
> >> i.e.
> >> C:\AntTest>set JAVA_HOME="C:\Program Files\Java\jdk.1.6.0_23"
> >> C:\AntTest>set ANT_HOME="C:\Program Files\Apache Software
> >> Foundation\apache-ant-1.8.2"
> >>
> >> Regards
> >>
> >> Andy Ling
> >>
> >>
> >>
> >> --
> >>
> >> This e-mail is intended for the named addressees only. Its contents may
> be
> >> privileged or confidential and should be treated as such. If you are not
> >> an intended recipient please notify the sender immediately and then
> delete
> >> it;  do not copy, distribute, or take any action based on this e-mail.
> In
> >> the pursuit of its legitimate business activities and its conformance
> with
> >> relevant legislation, Quantel may access any e-mail (including
> >> attachments) it originates or receives, for potential scrutiny.
> >>
> >> Quantel is the trade name used by Quantel Holdings Limited and its
> >> subsidiaries.  Quantel Holdings Limited is registered in England &
> Wales.
> >> Registration No: 4004913
> >> Contact details for all Quantel Offices and Companies can be found on
> our
> >> website www.quantel.com or by writing to the holding company.
> >> Registered address: Turnpike Road, Newbury, Berkshire, RG14 2NX, United
> >> Kingdom
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> >> For additional commands, e-mail: user-help@ant.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Re: Ant not respecting JAVA_HOME

Posted by an...@quantel.com.
Brian FitzGerald <bm...@gmail.com> wrote on 23/08/2011 10:41:12:

> I wrote a little .bat file (my first one, hence the ignorance),
> but it closes and opens before I can see the output to confirm there are 
no
> errors.  This is what it looks like:
> 
> pause
> cd C:\AntTest
> set JAVA_HOME=C:\Progra~1\Java\jdk1.6.0_23
> Ant
> pause
> 

Don't run the .bat file by double clicking on it. Open a cmd window and
type the name of the .bat file at the prompt. Then you will get
all the output in the cmd window, which wont disappear.

You may need to use the full path to the .bat file or add its location
to your PATH so it can be found. If it is in the current directory
you can run it using .\test.bat (or whatever it is called)

Hope that they helps

Andy Ling



-- 

This e-mail is intended for the named addressees only. Its contents may be 
privileged or confidential and should be treated as such. If you are not 
an intended recipient please notify the sender immediately and then delete 
it;  do not copy, distribute, or take any action based on this e-mail. In 
the pursuit of its legitimate business activities and its conformance with 
relevant legislation, Quantel may access any e-mail (including 
attachments) it originates or receives, for potential scrutiny. 

Quantel is the trade name used by Quantel Holdings Limited and its 
subsidiaries.  Quantel Holdings Limited is registered in England & Wales. 
Registration No: 4004913 
Contact details for all Quantel Offices and Companies can be found on our 
website www.quantel.com or by writing to the holding company.
Registered address: Turnpike Road, Newbury, Berkshire, RG14 2NX, United 
Kingdom 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant not respecting JAVA_HOME

Posted by Brian FitzGerald <bm...@gmail.com>.
Hey guys,

Thanks for the responses and tips.  I have put the CALL statement into the
script.  Before, I was opening the file before by double clicking on it (as
Andy guessed).  By running it from the command line it looks to be running
just fine - no errors!

Now to actually create the build and see what other issues I can run into :)

Brian



2011/8/23 Santanu Basu <sa...@tcs.com>

> Brian,
>
> How are you opening command prompt? From start->run by typing 'command' or
> by typing 'cmd'?
>
> Thanks,
>
>
>
> From:
> Brian FitzGerald <bm...@gmail.com>
> To:
> Ant Users List <us...@ant.apache.org>
> Date:
> 08/23/2011 03:19 PM
> Subject:
> Re: Ant not respecting JAVA_HOME
>
>
>
> Thanks a lot for the help guys.  Definitely making improvements.  The
> Progra~1 shorthand works to get Ant to find the right JDK when setting the
> JAVA_HOME manually before running the build... without having to manually
> set ANT_HOME, etc (commands below).  So I guess that is just something I
> will need to do manually each time before I run a build?  Something was
> said
> about a .bat file, I guess I could I write a bat file to automate
> resetting
> JAVA_HOME each time, couldn't I?
>
> This is the output from the Windows command prompt when I use the Progra~1
> shorthand:
>
> C:\Users\Brian>cd C:\AntTest
> C:\AntTest>set JAVA_HOME=C:\Progra~1\Java\jdk1.6.0_23
> C:\AntTest>Ant
> Buildfile: C:\AntTest\build.xml
>
> hello:
>     [echo] Hello, World
>
> BUILD SUCCESSFUL
> Total time: 0 seconds
>
> Looks good!  I wrote a little .bat file (my first one, hence the
> ignorance),
> but it closes and opens before I can see the output to confirm there are
> no
> errors.  This is what it looks like:
>
> pause
> cd C:\AntTest
> set JAVA_HOME=C:\Progra~1\Java\jdk1.6.0_23
> Ant
> pause
>
> I does run the target, but for some reason, the first pause works, but the
> last pause doesn't work and the command prompt closes before I can read
> the
> output.  I guess what I'm envisioning is a .bat which would:
>
>    1. set the JAVA_HOME
>    2. prompt me for the Ant target I want to run
>   3. run the ant target
>
> Thanks again for a few tips for this Ant rookie,
> Brian
>
>
>
>
> 2011/8/23 Parag Doke <pa...@gmail.com>
>
> > One more suggestion (same as the last email from Santanu) ...
> > Please try setting PATH to include JAVA_HOME\bin first and then the
> > existing PATH. So before you invoke ant from the cmd, type this:
> > set PATH=%JAVA_HOME%\bin;%PATH%
> >
> > I suspect that the JRE installation has put some kind of java.exe
> > under some Windows folder (system32?). So when it invokes java.exe, it
> > picks up the Windows folder one rather than the one under
> > JAVA_HOME\bin.
> >
> > If you can make your build.xml sleep for a minute and figure out the
> > path to the java.exe (I use ProcessExplorer free tool), this could be
> > confirmed.
> >
> > Do let us know how this goes,
> > Parag Doke
> > Save paper, save trees. Do not print emails/documents unless
> > absolutely necessary.
> >
> >
> >
> > On Mon, Aug 22, 2011 at 8:00 PM, Urena, Jose M (Jose)
> > <jo...@verizon.com> wrote:
> > > another tip, it is not pretty.
> > > in windows when paths have spaces, you can try using windows short
> names
> > >
> > > if you only have 1 dir that starts with "c:\Program"
> > > then the short name for "Program Files" is "progra~1"
> > >
> > > set JAVA_HOME="C:/progra~1/Java/jdk.1.6.0_23"
> > >
> > >
> > > the "dir /x c:\" can give you the short name for all files at c:\
> > >
> > > -----Original Message-----
> > > From: Parag Doke [mailto:parag.doke@gmail.com]
> > > Sent: Monday, August 22, 2011 10:26 AM
> > > To: Ant Users List
> > > Subject: Re: Ant not respecting JAVA_HOME
> > >
> > > The right syntax to include a value with spaces for batch files /
> cmd.exe
> > is:
> > > set "variable=value with spaces"
> > > So, you should have used
> > > set "JAVA_HOME=C:\Program Files\Java\jdk.1.6.0_23"
> > >
> > > Not sure if this might help you original issue though. Did you try to
> > comment the echo off line (precede with "rem ") in ant.bat / ant.cmd
> under
> > ANT_HOME/bin? Maybe, if you comment that, you will see on the console
> what
> > executable it is trying to run.
> > >
> > > Hope this helps,
> > > Parag Doke
> > > Save paper, save trees. Do not print emails/documents unless
> absolutely
> > necessary.
> > >
> > >
> > >
> > > On Mon, Aug 22, 2011 at 7:27 PM, Brian FitzGerald <
> > bmfitzgerald3@gmail.com> wrote:
> > >> Thanks for the help guys... this is what I got:
> > >>
> > >> WITH QUOTES:
> > >> 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:\Ant"
> > >> C:\AntTest>%ANT_HOME%\bin\ant
> > >> The syntax of the command is incorrect.
> > >>
> > >> WITHOUT QUOTES:
> > >> 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:\Ant C:\AntTest>%ANT_HOME%\bin\ant Unable
> to
> > >> locate tools.jar. Expected to find it in C:\Program
> Files\Java\jre6\li
> > >> b\tools.jar
> > >> Buildfile: C:\AntTest\build.xml
> > >>
> > >> hello:
> > >>     [echo] Hello, World
> > >>
> > >> BUILD SUCCESSFUL
> > >> Total time: 0 seconds
> > >>
> > >> So with quotes it wouldn't run at all.  Without quotes, it ran, but
> > >> still is looking in the JRE directory.  Is now a good time to start
> > >> banging my head against the wall?
> > >>
> > >> Brian
> > >>
> > >>
> > >>
> > >> 2011/8/22 <an...@quantel.com>
> > >>
> > >>> Santanu Basu <sa...@tcs.com> wrote on 22/08/2011 14:07:02:
> > >>>
> > >>> > 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
> > >>> > Foundation\apache-ant-1.8.2
> > >>> > C:\AntTest>%ANT_HOME%\bin\ant
> > >>> >
> > >>> > The above should work. Which version of Ant you are using?
> > >>> >
> > >>>
> > >>> Just to be sure, you should probably put quotes round those paths
> > >>> with spaces in.
> > >>>
> > >>> i.e.
> > >>> C:\AntTest>set JAVA_HOME="C:\Program Files\Java\jdk.1.6.0_23"
> > >>> C:\AntTest>set ANT_HOME="C:\Program Files\Apache Software
> > >>> Foundation\apache-ant-1.8.2"
> > >>>
> > >>> Regards
> > >>>
> > >>> Andy Ling
> > >>>
> > >>>
> > >>>
> > >>> --
> > >>>
> > >>> This e-mail is intended for the named addressees only. Its contents
> > >>> may be privileged or confidential and should be treated as such. If
> > >>> you are not an intended recipient please notify the sender
> > >>> immediately and then delete it;  do not copy, distribute, or take
> any
> > >>> action based on this e-mail. In the pursuit of its legitimate
> > >>> business activities and its conformance with relevant legislation,
> > >>> Quantel may access any e-mail (including
> > >>> attachments) it originates or receives, for potential scrutiny.
> > >>>
> > >>> Quantel is the trade name used by Quantel Holdings Limited and its
> > >>> subsidiaries.  Quantel Holdings Limited is registered in England &
> > Wales.
> > >>> Registration No: 4004913
> > >>> Contact details for all Quantel Offices and Companies can be found
> on
> > >>> our website www.quantel.com or by writing to the holding company.
> > >>> Registered address: Turnpike Road, Newbury, Berkshire, RG14 2NX,
> > >>> United Kingdom
> > >>>
> > >>>
> ---------------------------------------------------------------------
> > >>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For
> > >>> additional commands, e-mail: user-help@ant.apache.org
> > >>>
> > >>>
> > >>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
> > commands, e-mail: user-help@ant.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail: user-help@ant.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
>
>
> =====-----=====-----=====
> 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
>
>
>

Re: Ant not respecting JAVA_HOME

Posted by Santanu Basu <sa...@tcs.com>.
Brian,

How are you opening command prompt? From start->run by typing 'command' or 
by typing 'cmd'?

Thanks,



From:
Brian FitzGerald <bm...@gmail.com>
To:
Ant Users List <us...@ant.apache.org>
Date:
08/23/2011 03:19 PM
Subject:
Re: Ant not respecting JAVA_HOME



Thanks a lot for the help guys.  Definitely making improvements.  The
Progra~1 shorthand works to get Ant to find the right JDK when setting the
JAVA_HOME manually before running the build... without having to manually
set ANT_HOME, etc (commands below).  So I guess that is just something I
will need to do manually each time before I run a build?  Something was 
said
about a .bat file, I guess I could I write a bat file to automate 
resetting
JAVA_HOME each time, couldn't I?

This is the output from the Windows command prompt when I use the Progra~1
shorthand:

C:\Users\Brian>cd C:\AntTest
C:\AntTest>set JAVA_HOME=C:\Progra~1\Java\jdk1.6.0_23
C:\AntTest>Ant
Buildfile: C:\AntTest\build.xml

hello:
     [echo] Hello, World

BUILD SUCCESSFUL
Total time: 0 seconds

Looks good!  I wrote a little .bat file (my first one, hence the 
ignorance),
but it closes and opens before I can see the output to confirm there are 
no
errors.  This is what it looks like:

pause
cd C:\AntTest
set JAVA_HOME=C:\Progra~1\Java\jdk1.6.0_23
Ant
pause

I does run the target, but for some reason, the first pause works, but the
last pause doesn't work and the command prompt closes before I can read 
the
output.  I guess what I'm envisioning is a .bat which would:

   1. set the JAVA_HOME
   2. prompt me for the Ant target I want to run
   3. run the ant target

Thanks again for a few tips for this Ant rookie,
Brian




2011/8/23 Parag Doke <pa...@gmail.com>

> One more suggestion (same as the last email from Santanu) ...
> Please try setting PATH to include JAVA_HOME\bin first and then the
> existing PATH. So before you invoke ant from the cmd, type this:
> set PATH=%JAVA_HOME%\bin;%PATH%
>
> I suspect that the JRE installation has put some kind of java.exe
> under some Windows folder (system32?). So when it invokes java.exe, it
> picks up the Windows folder one rather than the one under
> JAVA_HOME\bin.
>
> If you can make your build.xml sleep for a minute and figure out the
> path to the java.exe (I use ProcessExplorer free tool), this could be
> confirmed.
>
> Do let us know how this goes,
> Parag Doke
> Save paper, save trees. Do not print emails/documents unless
> absolutely necessary.
>
>
>
> On Mon, Aug 22, 2011 at 8:00 PM, Urena, Jose M (Jose)
> <jo...@verizon.com> wrote:
> > another tip, it is not pretty.
> > in windows when paths have spaces, you can try using windows short 
names
> >
> > if you only have 1 dir that starts with "c:\Program"
> > then the short name for "Program Files" is "progra~1"
> >
> > set JAVA_HOME="C:/progra~1/Java/jdk.1.6.0_23"
> >
> >
> > the "dir /x c:\" can give you the short name for all files at c:\
> >
> > -----Original Message-----
> > From: Parag Doke [mailto:parag.doke@gmail.com]
> > Sent: Monday, August 22, 2011 10:26 AM
> > To: Ant Users List
> > Subject: Re: Ant not respecting JAVA_HOME
> >
> > The right syntax to include a value with spaces for batch files / 
cmd.exe
> is:
> > set "variable=value with spaces"
> > So, you should have used
> > set "JAVA_HOME=C:\Program Files\Java\jdk.1.6.0_23"
> >
> > Not sure if this might help you original issue though. Did you try to
> comment the echo off line (precede with "rem ") in ant.bat / ant.cmd 
under
> ANT_HOME/bin? Maybe, if you comment that, you will see on the console 
what
> executable it is trying to run.
> >
> > Hope this helps,
> > Parag Doke
> > Save paper, save trees. Do not print emails/documents unless 
absolutely
> necessary.
> >
> >
> >
> > On Mon, Aug 22, 2011 at 7:27 PM, Brian FitzGerald <
> bmfitzgerald3@gmail.com> wrote:
> >> Thanks for the help guys... this is what I got:
> >>
> >> WITH QUOTES:
> >> 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:\Ant"
> >> C:\AntTest>%ANT_HOME%\bin\ant
> >> The syntax of the command is incorrect.
> >>
> >> WITHOUT QUOTES:
> >> 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:\Ant C:\AntTest>%ANT_HOME%\bin\ant Unable 
to
> >> locate tools.jar. Expected to find it in C:\Program 
Files\Java\jre6\li
> >> b\tools.jar
> >> Buildfile: C:\AntTest\build.xml
> >>
> >> hello:
> >>     [echo] Hello, World
> >>
> >> BUILD SUCCESSFUL
> >> Total time: 0 seconds
> >>
> >> So with quotes it wouldn't run at all.  Without quotes, it ran, but
> >> still is looking in the JRE directory.  Is now a good time to start
> >> banging my head against the wall?
> >>
> >> Brian
> >>
> >>
> >>
> >> 2011/8/22 <an...@quantel.com>
> >>
> >>> Santanu Basu <sa...@tcs.com> wrote on 22/08/2011 14:07:02:
> >>>
> >>> > 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
> >>> > Foundation\apache-ant-1.8.2
> >>> > C:\AntTest>%ANT_HOME%\bin\ant
> >>> >
> >>> > The above should work. Which version of Ant you are using?
> >>> >
> >>>
> >>> Just to be sure, you should probably put quotes round those paths
> >>> with spaces in.
> >>>
> >>> i.e.
> >>> C:\AntTest>set JAVA_HOME="C:\Program Files\Java\jdk.1.6.0_23"
> >>> C:\AntTest>set ANT_HOME="C:\Program Files\Apache Software
> >>> Foundation\apache-ant-1.8.2"
> >>>
> >>> Regards
> >>>
> >>> Andy Ling
> >>>
> >>>
> >>>
> >>> --
> >>>
> >>> This e-mail is intended for the named addressees only. Its contents
> >>> may be privileged or confidential and should be treated as such. If
> >>> you are not an intended recipient please notify the sender
> >>> immediately and then delete it;  do not copy, distribute, or take 
any
> >>> action based on this e-mail. In the pursuit of its legitimate
> >>> business activities and its conformance with relevant legislation,
> >>> Quantel may access any e-mail (including
> >>> attachments) it originates or receives, for potential scrutiny.
> >>>
> >>> Quantel is the trade name used by Quantel Holdings Limited and its
> >>> subsidiaries.  Quantel Holdings Limited is registered in England &
> Wales.
> >>> Registration No: 4004913
> >>> Contact details for all Quantel Offices and Companies can be found 
on
> >>> our website www.quantel.com or by writing to the holding company.
> >>> Registered address: Turnpike Road, Newbury, Berkshire, RG14 2NX,
> >>> United Kingdom
> >>>
> >>> 
---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For
> >>> additional commands, e-mail: user-help@ant.apache.org
> >>>
> >>>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
> commands, e-mail: user-help@ant.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


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



Re: Ant not respecting JAVA_HOME

Posted by Stephen Connolly <st...@gmail.com>.
On 23 August 2011 10:41, Brian FitzGerald <bm...@gmail.com> wrote:
> Thanks a lot for the help guys.  Definitely making improvements.  The
> Progra~1 shorthand works to get Ant to find the right JDK when setting the
> JAVA_HOME manually before running the build... without having to manually
> set ANT_HOME, etc (commands below).  So I guess that is just something I
> will need to do manually each time before I run a build?  Something was said
> about a .bat file, I guess I could I write a bat file to automate resetting
> JAVA_HOME each time, couldn't I?
>
> This is the output from the Windows command prompt when I use the Progra~1
> shorthand:
>
> C:\Users\Brian>cd C:\AntTest
> C:\AntTest>set JAVA_HOME=C:\Progra~1\Java\jdk1.6.0_23
> C:\AntTest>Ant
> Buildfile: C:\AntTest\build.xml
>
> hello:
>     [echo] Hello, World
>
> BUILD SUCCESSFUL
> Total time: 0 seconds
>
> Looks good!  I wrote a little .bat file (my first one, hence the ignorance),
> but it closes and opens before I can see the output to confirm there are no
> errors.  This is what it looks like:
>
> pause
> cd C:\AntTest
> set JAVA_HOME=C:\Progra~1\Java\jdk1.6.0_23
> Ant
> pause
>
> I does run the target, but for some reason, the first pause works, but the
> last pause doesn't work and the command prompt closes before I can read the
> output.

ANT is itself a .BAT file

In windows when you invoke a .BAT file control is passed to that .BAT
file much like a GOTO and not like a GOSUB [I hate BASIC but hey]

What you want to do then is

CALL Ant

and not

Ant

As by adding that magic "CALL " in front you tell the CMD.EXE to
return control to you after ANT.BAT has finished running

> I guess what I'm envisioning is a .bat which would:
>
>   1. set the JAVA_HOME
>   2. prompt me for the Ant target I want to run
>   3. run the ant target
>
> Thanks again for a few tips for this Ant rookie,
> Brian
>
>
>
>
> 2011/8/23 Parag Doke <pa...@gmail.com>
>
>> One more suggestion (same as the last email from Santanu) ...
>> Please try setting PATH to include JAVA_HOME\bin first and then the
>> existing PATH. So before you invoke ant from the cmd, type this:
>> set PATH=%JAVA_HOME%\bin;%PATH%
>>
>> I suspect that the JRE installation has put some kind of java.exe
>> under some Windows folder (system32?). So when it invokes java.exe, it
>> picks up the Windows folder one rather than the one under
>> JAVA_HOME\bin.
>>
>> If you can make your build.xml sleep for a minute and figure out the
>> path to the java.exe (I use ProcessExplorer free tool), this could be
>> confirmed.
>>
>> Do let us know how this goes,
>> Parag Doke
>> Save paper, save trees. Do not print emails/documents unless
>> absolutely necessary.
>>
>>
>>
>> On Mon, Aug 22, 2011 at 8:00 PM, Urena, Jose M (Jose)
>> <jo...@verizon.com> wrote:
>> > another tip, it is not pretty.
>> > in windows when paths have spaces, you can try using windows short names
>> >
>> > if you only have 1 dir that starts with "c:\Program"
>> > then the short name for "Program Files" is "progra~1"
>> >
>> > set JAVA_HOME="C:/progra~1/Java/jdk.1.6.0_23"
>> >
>> >
>> > the "dir /x c:\" can give you the short name for all files at c:\
>> >
>> > -----Original Message-----
>> > From: Parag Doke [mailto:parag.doke@gmail.com]
>> > Sent: Monday, August 22, 2011 10:26 AM
>> > To: Ant Users List
>> > Subject: Re: Ant not respecting JAVA_HOME
>> >
>> > The right syntax to include a value with spaces for batch files / cmd.exe
>> is:
>> > set "variable=value with spaces"
>> > So, you should have used
>> > set "JAVA_HOME=C:\Program Files\Java\jdk.1.6.0_23"
>> >
>> > Not sure if this might help you original issue though. Did you try to
>> comment the echo off line (precede with "rem ") in ant.bat / ant.cmd under
>> ANT_HOME/bin? Maybe, if you comment that, you will see on the console what
>> executable it is trying to run.
>> >
>> > Hope this helps,
>> > Parag Doke
>> > Save paper, save trees. Do not print emails/documents unless absolutely
>> necessary.
>> >
>> >
>> >
>> > On Mon, Aug 22, 2011 at 7:27 PM, Brian FitzGerald <
>> bmfitzgerald3@gmail.com> wrote:
>> >> Thanks for the help guys... this is what I got:
>> >>
>> >> WITH QUOTES:
>> >> 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:\Ant"
>> >> C:\AntTest>%ANT_HOME%\bin\ant
>> >> The syntax of the command is incorrect.
>> >>
>> >> WITHOUT QUOTES:
>> >> 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:\Ant C:\AntTest>%ANT_HOME%\bin\ant Unable to
>> >> locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\li
>> >> b\tools.jar
>> >> Buildfile: C:\AntTest\build.xml
>> >>
>> >> hello:
>> >>     [echo] Hello, World
>> >>
>> >> BUILD SUCCESSFUL
>> >> Total time: 0 seconds
>> >>
>> >> So with quotes it wouldn't run at all.  Without quotes, it ran, but
>> >> still is looking in the JRE directory.  Is now a good time to start
>> >> banging my head against the wall?
>> >>
>> >> Brian
>> >>
>> >>
>> >>
>> >> 2011/8/22 <an...@quantel.com>
>> >>
>> >>> Santanu Basu <sa...@tcs.com> wrote on 22/08/2011 14:07:02:
>> >>>
>> >>> > 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
>> >>> > Foundation\apache-ant-1.8.2
>> >>> > C:\AntTest>%ANT_HOME%\bin\ant
>> >>> >
>> >>> > The above should work. Which version of Ant you are using?
>> >>> >
>> >>>
>> >>> Just to be sure, you should probably put quotes round those paths
>> >>> with spaces in.
>> >>>
>> >>> i.e.
>> >>> C:\AntTest>set JAVA_HOME="C:\Program Files\Java\jdk.1.6.0_23"
>> >>> C:\AntTest>set ANT_HOME="C:\Program Files\Apache Software
>> >>> Foundation\apache-ant-1.8.2"
>> >>>
>> >>> Regards
>> >>>
>> >>> Andy Ling
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>>
>> >>> This e-mail is intended for the named addressees only. Its contents
>> >>> may be privileged or confidential and should be treated as such. If
>> >>> you are not an intended recipient please notify the sender
>> >>> immediately and then delete it;  do not copy, distribute, or take any
>> >>> action based on this e-mail. In the pursuit of its legitimate
>> >>> business activities and its conformance with relevant legislation,
>> >>> Quantel may access any e-mail (including
>> >>> attachments) it originates or receives, for potential scrutiny.
>> >>>
>> >>> Quantel is the trade name used by Quantel Holdings Limited and its
>> >>> subsidiaries.  Quantel Holdings Limited is registered in England &
>> Wales.
>> >>> Registration No: 4004913
>> >>> Contact details for all Quantel Offices and Companies can be found on
>> >>> our website www.quantel.com or by writing to the holding company.
>> >>> Registered address: Turnpike Road, Newbury, Berkshire, RG14 2NX,
>> >>> United Kingdom
>> >>>
>> >>> ---------------------------------------------------------------------
>> >>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For
>> >>> additional commands, e-mail: user-help@ant.apache.org
>> >>>
>> >>>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
>> commands, e-mail: user-help@ant.apache.org
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> > For additional commands, e-mail: user-help@ant.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant not respecting JAVA_HOME

Posted by Brian FitzGerald <bm...@gmail.com>.
Thanks a lot for the help guys.  Definitely making improvements.  The
Progra~1 shorthand works to get Ant to find the right JDK when setting the
JAVA_HOME manually before running the build... without having to manually
set ANT_HOME, etc (commands below).  So I guess that is just something I
will need to do manually each time before I run a build?  Something was said
about a .bat file, I guess I could I write a bat file to automate resetting
JAVA_HOME each time, couldn't I?

This is the output from the Windows command prompt when I use the Progra~1
shorthand:

C:\Users\Brian>cd C:\AntTest
C:\AntTest>set JAVA_HOME=C:\Progra~1\Java\jdk1.6.0_23
C:\AntTest>Ant
Buildfile: C:\AntTest\build.xml

hello:
     [echo] Hello, World

BUILD SUCCESSFUL
Total time: 0 seconds

Looks good!  I wrote a little .bat file (my first one, hence the ignorance),
but it closes and opens before I can see the output to confirm there are no
errors.  This is what it looks like:

pause
cd C:\AntTest
set JAVA_HOME=C:\Progra~1\Java\jdk1.6.0_23
Ant
pause

I does run the target, but for some reason, the first pause works, but the
last pause doesn't work and the command prompt closes before I can read the
output.  I guess what I'm envisioning is a .bat which would:

   1. set the JAVA_HOME
   2. prompt me for the Ant target I want to run
   3. run the ant target

Thanks again for a few tips for this Ant rookie,
Brian




2011/8/23 Parag Doke <pa...@gmail.com>

> One more suggestion (same as the last email from Santanu) ...
> Please try setting PATH to include JAVA_HOME\bin first and then the
> existing PATH. So before you invoke ant from the cmd, type this:
> set PATH=%JAVA_HOME%\bin;%PATH%
>
> I suspect that the JRE installation has put some kind of java.exe
> under some Windows folder (system32?). So when it invokes java.exe, it
> picks up the Windows folder one rather than the one under
> JAVA_HOME\bin.
>
> If you can make your build.xml sleep for a minute and figure out the
> path to the java.exe (I use ProcessExplorer free tool), this could be
> confirmed.
>
> Do let us know how this goes,
> Parag Doke
> Save paper, save trees. Do not print emails/documents unless
> absolutely necessary.
>
>
>
> On Mon, Aug 22, 2011 at 8:00 PM, Urena, Jose M (Jose)
> <jo...@verizon.com> wrote:
> > another tip, it is not pretty.
> > in windows when paths have spaces, you can try using windows short names
> >
> > if you only have 1 dir that starts with "c:\Program"
> > then the short name for "Program Files" is "progra~1"
> >
> > set JAVA_HOME="C:/progra~1/Java/jdk.1.6.0_23"
> >
> >
> > the "dir /x c:\" can give you the short name for all files at c:\
> >
> > -----Original Message-----
> > From: Parag Doke [mailto:parag.doke@gmail.com]
> > Sent: Monday, August 22, 2011 10:26 AM
> > To: Ant Users List
> > Subject: Re: Ant not respecting JAVA_HOME
> >
> > The right syntax to include a value with spaces for batch files / cmd.exe
> is:
> > set "variable=value with spaces"
> > So, you should have used
> > set "JAVA_HOME=C:\Program Files\Java\jdk.1.6.0_23"
> >
> > Not sure if this might help you original issue though. Did you try to
> comment the echo off line (precede with "rem ") in ant.bat / ant.cmd under
> ANT_HOME/bin? Maybe, if you comment that, you will see on the console what
> executable it is trying to run.
> >
> > Hope this helps,
> > Parag Doke
> > Save paper, save trees. Do not print emails/documents unless absolutely
> necessary.
> >
> >
> >
> > On Mon, Aug 22, 2011 at 7:27 PM, Brian FitzGerald <
> bmfitzgerald3@gmail.com> wrote:
> >> Thanks for the help guys... this is what I got:
> >>
> >> WITH QUOTES:
> >> 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:\Ant"
> >> C:\AntTest>%ANT_HOME%\bin\ant
> >> The syntax of the command is incorrect.
> >>
> >> WITHOUT QUOTES:
> >> 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:\Ant C:\AntTest>%ANT_HOME%\bin\ant Unable to
> >> locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\li
> >> b\tools.jar
> >> Buildfile: C:\AntTest\build.xml
> >>
> >> hello:
> >>     [echo] Hello, World
> >>
> >> BUILD SUCCESSFUL
> >> Total time: 0 seconds
> >>
> >> So with quotes it wouldn't run at all.  Without quotes, it ran, but
> >> still is looking in the JRE directory.  Is now a good time to start
> >> banging my head against the wall?
> >>
> >> Brian
> >>
> >>
> >>
> >> 2011/8/22 <an...@quantel.com>
> >>
> >>> Santanu Basu <sa...@tcs.com> wrote on 22/08/2011 14:07:02:
> >>>
> >>> > 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
> >>> > Foundation\apache-ant-1.8.2
> >>> > C:\AntTest>%ANT_HOME%\bin\ant
> >>> >
> >>> > The above should work. Which version of Ant you are using?
> >>> >
> >>>
> >>> Just to be sure, you should probably put quotes round those paths
> >>> with spaces in.
> >>>
> >>> i.e.
> >>> C:\AntTest>set JAVA_HOME="C:\Program Files\Java\jdk.1.6.0_23"
> >>> C:\AntTest>set ANT_HOME="C:\Program Files\Apache Software
> >>> Foundation\apache-ant-1.8.2"
> >>>
> >>> Regards
> >>>
> >>> Andy Ling
> >>>
> >>>
> >>>
> >>> --
> >>>
> >>> This e-mail is intended for the named addressees only. Its contents
> >>> may be privileged or confidential and should be treated as such. If
> >>> you are not an intended recipient please notify the sender
> >>> immediately and then delete it;  do not copy, distribute, or take any
> >>> action based on this e-mail. In the pursuit of its legitimate
> >>> business activities and its conformance with relevant legislation,
> >>> Quantel may access any e-mail (including
> >>> attachments) it originates or receives, for potential scrutiny.
> >>>
> >>> Quantel is the trade name used by Quantel Holdings Limited and its
> >>> subsidiaries.  Quantel Holdings Limited is registered in England &
> Wales.
> >>> Registration No: 4004913
> >>> Contact details for all Quantel Offices and Companies can be found on
> >>> our website www.quantel.com or by writing to the holding company.
> >>> Registered address: Turnpike Road, Newbury, Berkshire, RG14 2NX,
> >>> United Kingdom
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For
> >>> additional commands, e-mail: user-help@ant.apache.org
> >>>
> >>>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
> commands, e-mail: user-help@ant.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Re: Ant not respecting JAVA_HOME

Posted by Parag Doke <pa...@gmail.com>.
One more suggestion (same as the last email from Santanu) ...
Please try setting PATH to include JAVA_HOME\bin first and then the
existing PATH. So before you invoke ant from the cmd, type this:
set PATH=%JAVA_HOME%\bin;%PATH%

I suspect that the JRE installation has put some kind of java.exe
under some Windows folder (system32?). So when it invokes java.exe, it
picks up the Windows folder one rather than the one under
JAVA_HOME\bin.

If you can make your build.xml sleep for a minute and figure out the
path to the java.exe (I use ProcessExplorer free tool), this could be
confirmed.

Do let us know how this goes,
Parag Doke
Save paper, save trees. Do not print emails/documents unless
absolutely necessary.



On Mon, Aug 22, 2011 at 8:00 PM, Urena, Jose M (Jose)
<jo...@verizon.com> wrote:
> another tip, it is not pretty.
> in windows when paths have spaces, you can try using windows short names
>
> if you only have 1 dir that starts with "c:\Program"
> then the short name for "Program Files" is "progra~1"
>
> set JAVA_HOME="C:/progra~1/Java/jdk.1.6.0_23"
>
>
> the "dir /x c:\" can give you the short name for all files at c:\
>
> -----Original Message-----
> From: Parag Doke [mailto:parag.doke@gmail.com]
> Sent: Monday, August 22, 2011 10:26 AM
> To: Ant Users List
> Subject: Re: Ant not respecting JAVA_HOME
>
> The right syntax to include a value with spaces for batch files / cmd.exe is:
> set "variable=value with spaces"
> So, you should have used
> set "JAVA_HOME=C:\Program Files\Java\jdk.1.6.0_23"
>
> Not sure if this might help you original issue though. Did you try to comment the echo off line (precede with "rem ") in ant.bat / ant.cmd under ANT_HOME/bin? Maybe, if you comment that, you will see on the console what executable it is trying to run.
>
> Hope this helps,
> Parag Doke
> Save paper, save trees. Do not print emails/documents unless absolutely necessary.
>
>
>
> On Mon, Aug 22, 2011 at 7:27 PM, Brian FitzGerald <bm...@gmail.com> wrote:
>> Thanks for the help guys... this is what I got:
>>
>> WITH QUOTES:
>> 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:\Ant"
>> C:\AntTest>%ANT_HOME%\bin\ant
>> The syntax of the command is incorrect.
>>
>> WITHOUT QUOTES:
>> 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:\Ant C:\AntTest>%ANT_HOME%\bin\ant Unable to
>> locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\li
>> b\tools.jar
>> Buildfile: C:\AntTest\build.xml
>>
>> hello:
>>     [echo] Hello, World
>>
>> BUILD SUCCESSFUL
>> Total time: 0 seconds
>>
>> So with quotes it wouldn't run at all.  Without quotes, it ran, but
>> still is looking in the JRE directory.  Is now a good time to start
>> banging my head against the wall?
>>
>> Brian
>>
>>
>>
>> 2011/8/22 <an...@quantel.com>
>>
>>> Santanu Basu <sa...@tcs.com> wrote on 22/08/2011 14:07:02:
>>>
>>> > 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
>>> > Foundation\apache-ant-1.8.2
>>> > C:\AntTest>%ANT_HOME%\bin\ant
>>> >
>>> > The above should work. Which version of Ant you are using?
>>> >
>>>
>>> Just to be sure, you should probably put quotes round those paths
>>> with spaces in.
>>>
>>> i.e.
>>> C:\AntTest>set JAVA_HOME="C:\Program Files\Java\jdk.1.6.0_23"
>>> C:\AntTest>set ANT_HOME="C:\Program Files\Apache Software
>>> Foundation\apache-ant-1.8.2"
>>>
>>> Regards
>>>
>>> Andy Ling
>>>
>>>
>>>
>>> --
>>>
>>> This e-mail is intended for the named addressees only. Its contents
>>> may be privileged or confidential and should be treated as such. If
>>> you are not an intended recipient please notify the sender
>>> immediately and then delete it;  do not copy, distribute, or take any
>>> action based on this e-mail. In the pursuit of its legitimate
>>> business activities and its conformance with relevant legislation,
>>> Quantel may access any e-mail (including
>>> attachments) it originates or receives, for potential scrutiny.
>>>
>>> Quantel is the trade name used by Quantel Holdings Limited and its
>>> subsidiaries.  Quantel Holdings Limited is registered in England & Wales.
>>> Registration No: 4004913
>>> Contact details for all Quantel Offices and Companies can be found on
>>> our website www.quantel.com or by writing to the holding company.
>>> Registered address: Turnpike Road, Newbury, Berkshire, RG14 2NX,
>>> United Kingdom
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For
>>> additional commands, e-mail: user-help@ant.apache.org
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Ant not respecting JAVA_HOME

Posted by "Urena, Jose M (Jose)" <jo...@verizon.com>.
another tip, it is not pretty. 
in windows when paths have spaces, you can try using windows short names

if you only have 1 dir that starts with "c:\Program"
then the short name for "Program Files" is "progra~1"

set JAVA_HOME="C:/progra~1/Java/jdk.1.6.0_23"
 

the "dir /x c:\" can give you the short name for all files at c:\ 

-----Original Message-----
From: Parag Doke [mailto:parag.doke@gmail.com] 
Sent: Monday, August 22, 2011 10:26 AM
To: Ant Users List
Subject: Re: Ant not respecting JAVA_HOME

The right syntax to include a value with spaces for batch files / cmd.exe is:
set "variable=value with spaces"
So, you should have used
set "JAVA_HOME=C:\Program Files\Java\jdk.1.6.0_23"

Not sure if this might help you original issue though. Did you try to comment the echo off line (precede with "rem ") in ant.bat / ant.cmd under ANT_HOME/bin? Maybe, if you comment that, you will see on the console what executable it is trying to run.

Hope this helps,
Parag Doke
Save paper, save trees. Do not print emails/documents unless absolutely necessary.



On Mon, Aug 22, 2011 at 7:27 PM, Brian FitzGerald <bm...@gmail.com> wrote:
> Thanks for the help guys... this is what I got:
>
> WITH QUOTES:
> 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:\Ant"
> C:\AntTest>%ANT_HOME%\bin\ant
> The syntax of the command is incorrect.
>
> WITHOUT QUOTES:
> 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:\Ant C:\AntTest>%ANT_HOME%\bin\ant Unable to 
> locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\li 
> b\tools.jar
> Buildfile: C:\AntTest\build.xml
>
> hello:
>     [echo] Hello, World
>
> BUILD SUCCESSFUL
> Total time: 0 seconds
>
> So with quotes it wouldn't run at all.  Without quotes, it ran, but 
> still is looking in the JRE directory.  Is now a good time to start 
> banging my head against the wall?
>
> Brian
>
>
>
> 2011/8/22 <an...@quantel.com>
>
>> Santanu Basu <sa...@tcs.com> wrote on 22/08/2011 14:07:02:
>>
>> > 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
>> > Foundation\apache-ant-1.8.2
>> > C:\AntTest>%ANT_HOME%\bin\ant
>> >
>> > The above should work. Which version of Ant you are using?
>> >
>>
>> Just to be sure, you should probably put quotes round those paths 
>> with spaces in.
>>
>> i.e.
>> C:\AntTest>set JAVA_HOME="C:\Program Files\Java\jdk.1.6.0_23"
>> C:\AntTest>set ANT_HOME="C:\Program Files\Apache Software 
>> Foundation\apache-ant-1.8.2"
>>
>> Regards
>>
>> Andy Ling
>>
>>
>>
>> --
>>
>> This e-mail is intended for the named addressees only. Its contents 
>> may be privileged or confidential and should be treated as such. If 
>> you are not an intended recipient please notify the sender 
>> immediately and then delete it;  do not copy, distribute, or take any 
>> action based on this e-mail. In the pursuit of its legitimate 
>> business activities and its conformance with relevant legislation, 
>> Quantel may access any e-mail (including
>> attachments) it originates or receives, for potential scrutiny.
>>
>> Quantel is the trade name used by Quantel Holdings Limited and its 
>> subsidiaries.  Quantel Holdings Limited is registered in England & Wales.
>> Registration No: 4004913
>> Contact details for all Quantel Offices and Companies can be found on 
>> our website www.quantel.com or by writing to the holding company.
>> Registered address: Turnpike Road, Newbury, Berkshire, RG14 2NX, 
>> United Kingdom
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For 
>> additional commands, e-mail: user-help@ant.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant not respecting JAVA_HOME

Posted by Parag Doke <pa...@gmail.com>.
The right syntax to include a value with spaces for batch files / cmd.exe is:
set "variable=value with spaces"
So, you should have used
set "JAVA_HOME=C:\Program Files\Java\jdk.1.6.0_23"

Not sure if this might help you original issue though. Did you try to
comment the echo off line (precede with "rem ") in ant.bat / ant.cmd
under ANT_HOME/bin? Maybe, if you comment that, you will see on the
console what executable it is trying to run.

Hope this helps,
Parag Doke
Save paper, save trees. Do not print emails/documents unless
absolutely necessary.



On Mon, Aug 22, 2011 at 7:27 PM, Brian FitzGerald
<bm...@gmail.com> wrote:
> Thanks for the help guys... this is what I got:
>
> WITH QUOTES:
> 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:\Ant"
> C:\AntTest>%ANT_HOME%\bin\ant
> The syntax of the command is incorrect.
>
> WITHOUT QUOTES:
> 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:\Ant
> C:\AntTest>%ANT_HOME%\bin\ant
> Unable to locate tools.jar. Expected to find it in C:\Program
> Files\Java\jre6\li
> b\tools.jar
> Buildfile: C:\AntTest\build.xml
>
> hello:
>     [echo] Hello, World
>
> BUILD SUCCESSFUL
> Total time: 0 seconds
>
> So with quotes it wouldn't run at all.  Without quotes, it ran, but still is
> looking in the JRE directory.  Is now a good time to start banging my head
> against the wall?
>
> Brian
>
>
>
> 2011/8/22 <an...@quantel.com>
>
>> Santanu Basu <sa...@tcs.com> wrote on 22/08/2011 14:07:02:
>>
>> > 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
>> > Foundation\apache-ant-1.8.2
>> > C:\AntTest>%ANT_HOME%\bin\ant
>> >
>> > The above should work. Which version of Ant you are using?
>> >
>>
>> Just to be sure, you should probably put quotes round those
>> paths with spaces in.
>>
>> i.e.
>> C:\AntTest>set JAVA_HOME="C:\Program Files\Java\jdk.1.6.0_23"
>> C:\AntTest>set ANT_HOME="C:\Program Files\Apache Software
>> Foundation\apache-ant-1.8.2"
>>
>> Regards
>>
>> Andy Ling
>>
>>
>>
>> --
>>
>> This e-mail is intended for the named addressees only. Its contents may be
>> privileged or confidential and should be treated as such. If you are not
>> an intended recipient please notify the sender immediately and then delete
>> it;  do not copy, distribute, or take any action based on this e-mail. In
>> the pursuit of its legitimate business activities and its conformance with
>> relevant legislation, Quantel may access any e-mail (including
>> attachments) it originates or receives, for potential scrutiny.
>>
>> Quantel is the trade name used by Quantel Holdings Limited and its
>> subsidiaries.  Quantel Holdings Limited is registered in England & Wales.
>> Registration No: 4004913
>> Contact details for all Quantel Offices and Companies can be found on our
>> website www.quantel.com or by writing to the holding company.
>> Registered address: Turnpike Road, Newbury, Berkshire, RG14 2NX, United
>> Kingdom
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant not respecting JAVA_HOME

Posted by Donald McLean <dm...@stsci.edu>.
How about putting quotes only around the part with the space?

Alternately, is there an escape for the space? (in some form so Unix "\ 
" works).

On 8/22/11 9:57 AM, Brian FitzGerald wrote:
> Thanks for the help guys... this is what I got:
>
> WITH QUOTES:
> 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:\Ant"
> C:\AntTest>%ANT_HOME%\bin\ant
> The syntax of the command is incorrect.
>
> WITHOUT QUOTES:
> 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:\Ant
> C:\AntTest>%ANT_HOME%\bin\ant
> Unable to locate tools.jar. Expected to find it in C:\Program
> Files\Java\jre6\li
> b\tools.jar
> Buildfile: C:\AntTest\build.xml
>
> hello:
>       [echo] Hello, World
>
> BUILD SUCCESSFUL
> Total time: 0 seconds
>
> So with quotes it wouldn't run at all.  Without quotes, it ran, but still is
> looking in the JRE directory.  Is now a good time to start banging my head
> against the wall?


Re: Ant not respecting JAVA_HOME

Posted by Brian FitzGerald <bm...@gmail.com>.
Thanks for the help guys... this is what I got:

WITH QUOTES:
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:\Ant"
C:\AntTest>%ANT_HOME%\bin\ant
The syntax of the command is incorrect.

WITHOUT QUOTES:
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:\Ant
C:\AntTest>%ANT_HOME%\bin\ant
Unable to locate tools.jar. Expected to find it in C:\Program
Files\Java\jre6\li
b\tools.jar
Buildfile: C:\AntTest\build.xml

hello:
     [echo] Hello, World

BUILD SUCCESSFUL
Total time: 0 seconds

So with quotes it wouldn't run at all.  Without quotes, it ran, but still is
looking in the JRE directory.  Is now a good time to start banging my head
against the wall?

Brian



2011/8/22 <an...@quantel.com>

> Santanu Basu <sa...@tcs.com> wrote on 22/08/2011 14:07:02:
>
> > 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
> > Foundation\apache-ant-1.8.2
> > C:\AntTest>%ANT_HOME%\bin\ant
> >
> > The above should work. Which version of Ant you are using?
> >
>
> Just to be sure, you should probably put quotes round those
> paths with spaces in.
>
> i.e.
> C:\AntTest>set JAVA_HOME="C:\Program Files\Java\jdk.1.6.0_23"
> C:\AntTest>set ANT_HOME="C:\Program Files\Apache Software
> Foundation\apache-ant-1.8.2"
>
> Regards
>
> Andy Ling
>
>
>
> --
>
> This e-mail is intended for the named addressees only. Its contents may be
> privileged or confidential and should be treated as such. If you are not
> an intended recipient please notify the sender immediately and then delete
> it;  do not copy, distribute, or take any action based on this e-mail. In
> the pursuit of its legitimate business activities and its conformance with
> relevant legislation, Quantel may access any e-mail (including
> attachments) it originates or receives, for potential scrutiny.
>
> Quantel is the trade name used by Quantel Holdings Limited and its
> subsidiaries.  Quantel Holdings Limited is registered in England & Wales.
> Registration No: 4004913
> Contact details for all Quantel Offices and Companies can be found on our
> website www.quantel.com or by writing to the holding company.
> Registered address: Turnpike Road, Newbury, Berkshire, RG14 2NX, United
> Kingdom
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Re: Ant not respecting JAVA_HOME

Posted by an...@quantel.com.
Santanu Basu <sa...@tcs.com> wrote on 22/08/2011 14:07:02:

> 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 
> Foundation\apache-ant-1.8.2
> C:\AntTest>%ANT_HOME%\bin\ant
> 
> The above should work. Which version of Ant you are using?
> 

Just to be sure, you should probably put quotes round those
paths with spaces in.

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

Regards

Andy Ling



-- 

This e-mail is intended for the named addressees only. Its contents may be 
privileged or confidential and should be treated as such. If you are not 
an intended recipient please notify the sender immediately and then delete 
it;  do not copy, distribute, or take any action based on this e-mail. In 
the pursuit of its legitimate business activities and its conformance with 
relevant legislation, Quantel may access any e-mail (including 
attachments) it originates or receives, for potential scrutiny. 

Quantel is the trade name used by Quantel Holdings Limited and its 
subsidiaries.  Quantel Holdings Limited is registered in England & Wales. 
Registration No: 4004913 
Contact details for all Quantel Offices and Companies can be found on our 
website www.quantel.com or by writing to the holding company.
Registered address: Turnpike Road, Newbury, Berkshire, RG14 2NX, United 
Kingdom 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant not respecting JAVA_HOME

Posted by Santanu Basu <sa...@tcs.com>.
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 
Foundation\apache-ant-1.8.2
C:\AntTest>%ANT_HOME%\bin\ant

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

Thanks,
Santanu



From:
Brian FitzGerald <bm...@gmail.com>
To:
Ant Users List <us...@ant.apache.org>
Date:
08/22/2011 06:06 PM
Subject:
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 
ant?
> 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 
and
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 
with
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
>Foundation\apache-ant-1.8.2
>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 
the
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
C:\AntTest>Ant
Unable to locate tools.jar. Expected to find it in C:\Program
Files\Java\jre6\lib\tools.jar
Buildfile: C:\AntTest\build.xml

hello:
     [echo] Hello, World

BUILD SUCCESSFUL
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?

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



Re: Ant not respecting JAVA_HOME

Posted by Brian FitzGerald <bm...@gmail.com>.
Thank you for the response, Santanu.

> Do you have the build.xml in the directory from where you are running ant?
> 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 and
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 with
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
>Foundation\apache-ant-1.8.2
>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 the
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
C:\AntTest>Ant
Unable to locate tools.jar. Expected to find it in C:\Program
Files\Java\jre6\lib\tools.jar
Buildfile: C:\AntTest\build.xml

hello:
     [echo] Hello, World

BUILD SUCCESSFUL
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?

Thanks,
Brian

Re: Ant not respecting JAVA_HOME

Posted by Santanu Basu <sa...@tcs.com>.
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 <bm...@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