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:[EMAIL PROTECTED] 
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: [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