ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Classpath in Java task
Date Wed, 12 Mar 2003 21:02:31 GMT
Just fork the Java process your task starts. This will eliminate the strange
classloader issues you are seeing. Your task basically uses/composes a
<java> task, configures it (possibly using the datatypes and arguments of
your own task), then executes it in forked mode (javaTask.setFork(true);).

See my <jaxb> task for an example of such a technique. The task itself
doesn't depend on Jaxb, but it starts programmatically the Jaxb schema
compiler using an internal <java> task. <jaxb> is in Ant's BugZilla.

--DD

-----Original Message-----
From: John Guthrie [mailto:jguthrie@psynapsetech.net] 
Sent: Wednesday, March 12, 2003 2:53 PM
To: Ant Users List
Subject: Re: Classpath in Java task

> > so my question is how do i get the rt.jar into my Java object's
> > classpath?
>
> You could add the JRE libraries to the classpath you pass in to
> <taskdef , but that doesn't get you completely out of the fire.
>

but i don't want to have to hunt up where the jre is, or require folks using
my task to do so either. i want to be able to pass on the classpath that the
task is using if i can really.

> > is there a way to get the classpath that is in my task and pass
> > that on to the Java task (along with that the user specified),
> > and/or is that even a good idea?
>
> How exactly is your <taskdef set up?
>

i am testing with something a la
 <target name="oofa">
    <taskdef name="loofa" classname="org.foo.Loofa"
classpathref="some.classpath">
   ....

the classpathref basically points to a bunch of support jars the ultimate
java class needs (e.g. antlr.jar) but not rt.jar (who ever needs to add
rt.jar to their classpath?)

thanks.

john


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

Mime
View raw message