IMHO you are being "helped" by the windows command processor. I think it
treats whitespace as meaningless. What you would end up with is ...-cacheDir
-dt... which the command processor will reduce to ...-cacheDir -dt...

Try typing the command on the command line exactly like it would be
presented by Ant and you should see the same results.

My suggestion would be to pass the ${my.property} argument as a keyword and
value then base the programs behavior on the value of the keyword parameter.
This should work in all os.

HTH Bill

-----Original Message-----
From: Martin Senger [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 01, 2005 1:37 AM
To: Ant Users List
Subject: Re: Empty arguments on the command-line under windows

Hi,
> 
> If you run ANT in verbose mode (-v) what does it output as the string 
> that is generated...?
>
   This is how it look underw windows:

[testing] Executing 'C:\Program Files\Java\jre1.5.0_04\bin\java.exe' with
arguments:
  [testing] '-classpath'
  [testing] 'C:\Documents and settings\martin\....jar'
  [testing] 'TestArgs'
  [testing] '-cacheDir'
  [testing] ''
  [testing] '-dt'
  [testing]
  [testing] The ' characters around the executable and arguments are
  [testing] not part of the command.
  [testing] 0: -cacheDir
  [testing] 1: -dt

   And this is how it looks under linux:

[testing] Executing '/usr/local/j2sdk1.4.2_08/jre/bin/java' with
arguments:
  [testing] '-classpath'
  [testing] '/home/senger/....jar'
  [testing] 'TestArgs'
  [testing] '-cacheDir'
  [testing] ''
  [testing] '-dt'
  [testing]
  [testing] The ' characters around the executable and arguments are
  [testing] not part of the command.
  [testing] 0: -cacheDir
  [testing] 1:
  [testing] 2: -dt


   And this is the Ant task (I have already posted this in my previous
email, sorry for the repetition):

     <property name="my.property" value=""/>

     <java classname="TestArgs" taskname="testing"
       classpathref="build.classpath" fork="true" failonerror="true">
       <arg value="-cacheDir"/>
       <arg value="${my.property}"/>
       <arg value="-dt"/>
     </java>

   So my (sad) conclusion is that I must write my build.xml conditionally
for various OS's. That's also what Antoine suggested:

> you can, using the condition task, set registry.cache.dir to 
> &quot;&quot; only when running under windows.
>

   Is this usual with Ant and OS-dependency? This is the first time I am
forced to be switching between OS's so I can't say.

   Many thanks for your help and suggestions. At least I know now how to
solve the problem. (But still, I think I am going to look into Ant's sources
why it is like it is... )

   Cheers,
   Martin

--
Martin Senger
   email: [EMAIL PROTECTED]
   skype: martinsenger
consulting for:
   International Rice Research Institute
   Biometrics and Bioinformatics Unit
   DAPO BOX 7777, Metro Manila
   Philippines, phone: +63-2-580-5600 (ext.2324)




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to