ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Daniels <c...@yahoo.com>
Subject Re: Classpath as a string..
Date Mon, 21 Jun 2004 13:47:17 GMT
--- Robert Mark Bram <relaxedrob@optusnet.com.au> wrote:
> Hi All!
> 
> In some targets of my build file, I have a classpath like this:
> 
> <classpath>
>       <pathelement location="${src}" />
>       <filelist refid="test.jarfiles" />
> </classpath>
> 
> But now I am writing a target where I need to send the classpath as an
> argument to a Java command that is itself an argument to a Java app that
> will *run* the command:
> 
> <target name="runProcess">
>       <java classname="test.ProcessRunner" fork="true">
> <arg line="-command java test.NewProcess" />
> <arg line="-cp ... " />
>       </java>
> </target>
> 
> So I need the classpath - and I need it to be portable (i.e. I still need
> to deal with the classpath as properties).
> 
> Can anyone suggest a way to do this?

Define your classpath as a path with an id, like so

<path id="myclasspath">
    <pathelement location="${src}" />
    <filelist refid="test.jarfiles" />
</path>

Then use the classpathref attribute of the java task, like so

<target name="runProcess">
    <java
        classpathrefid="myclasspath"
        classname="test.ProcessRunner"
        fork="true">

        <arg line="-command java test.NewProcess" />
        <arg line="-cp ... " />
    </java>
</target>


> 
> Thanks for any advice!
> 
> Rob
> :)
> 
> 
> -- 
> Robert Mark Bram
> B.Comp.(Systems Development/Business Systems)
> B.Net.Comp.(Hons)
> Doctor of Philosophy Student
> 
> School of Network Computing
> Faculty of Information Technology
> Monash University
> Peninsula Campus
> McMahons Rd
> Frankston, VIC 3199
> AUSTRALIA
> 
> Phone:  61 3 9904 4394
> Facsimile:  61 3 9904 4124
> Email: robert.mark.bram@infotech.monash.edu.au
> 
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message