You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Michael Kaegi <ka...@brainware.ch> on 2003/04/04 18:16:30 UTC

Strange problem with tag

Hi

I try to execute a batch file("foo.bat") from an Ant build script. The 
batch file executes a java application. 
The java application requires some additional libraries. The libraries are loaded over the java 

classpath option. Now I want specify the classpath using the Ant <arg> 
tag.

E.g.. 

<target name="foo">
        <exec executable="foo.bat">
            <arg line="-cp classes;lib/bar.jar"/>
        </exec>
</target>

foo.bat:

echo %1 %2 %3
rem java -cp 2% foo.Foo


The problem is that something goes wrong with the classpath.
In detail the semicolon between the lib files is missing.

E.g..

java -cp classes lib/bar.jar foo.Foo

in place of

java -cp classes;lib/bar.jar foo.Foo


Any suggestions or pointers would be greatly appreciated. 
Thanks in advance. , 

montsie 

Re: Strange problem with tag

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: <Ma...@cs.tcd.ie>
To: "'Ant Users List'" <us...@ant.apache.org>
Sent: Saturday, April 05, 2003 05:28
Subject: RE: Strange problem with <arg> tag


> Hi Montsie,
>      Could ye maybe try putting the classes;lib/bar.jar in enclosed
> escaped quotes? Maybe the ; is getting parsed out at some stage?
>
> HTH,
> Mark.

yes -some of the BAT handling in versions of windows split up semicolons.
There are workarounds for this in ants own handling of its command line
parameters.


RE: Strange problem with tag

Posted by Ma...@cs.tcd.ie.
Hi Montsie,
     Could ye maybe try putting the classes;lib/bar.jar in enclosed
escaped quotes? Maybe the ; is getting parsed out at some stage?

HTH,
Mark.


i.e.
<target name="foo">
        <exec executable="foo.bat">
            <arg line="-cp \"classes;lib/bar.jar\""/>
        </exec>
</target>

-----Original Message-----
From: Michael Kaegi [mailto:kam@brainware.ch] 
Sent: 04 April 2003 17:17
To: user@ant.apache.org
Subject: Strange problem with <arg> tag

Hi

I try to execute a batch file("foo.bat") from an Ant build script. The 
batch file executes a java application. 
The java application requires some additional libraries. The libraries
are loaded over the java 

classpath option. Now I want specify the classpath using the Ant <arg> 
tag.

E.g.. 

<target name="foo">
        <exec executable="foo.bat">
            <arg line="-cp classes;lib/bar.jar"/>
        </exec>
</target>

foo.bat:

echo %1 %2 %3
rem java -cp 2% foo.Foo


The problem is that something goes wrong with the classpath.
In detail the semicolon between the lib files is missing.

E.g..

java -cp classes lib/bar.jar foo.Foo

in place of

java -cp classes;lib/bar.jar foo.Foo


Any suggestions or pointers would be greatly appreciated. 
Thanks in advance. , 

montsie