ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: FW: Problem with ANT classloader?
Date Mon, 20 May 2002 14:36:09 GMT
OK, maybe I got a little impatient ;-) Posted on ant-user around 11am, and
complained about lack of answers by 2:30pm, all on a Friday... Sorry!

Thanks for all the answers, Ara, Peter, Conor, Steve. Now I understand
better what's going on with the background provided. Although I'm sure I
didn't grasp everything that was written, it came to me that there might be
an easier solution to deal with ClassLoaders (but I'll probably be shot down
because it turns out to be stupid ;-). I don't know if it plays well with
1.1 compatibility, since I never cared for it, and actually started using
Java2 from the get go (missed the early days!).

So you want to isolate the <java> program from the ANT classes? Then load
all ANT classes through some kind of ANT-specific class loader. Do not set
the classpath of the system class loader (AppClassLoader) at all, but
instead configure your own Secure URL classloader through other means.

When you run <java> in-process, you create another class loader for it, with
the system class loader as its parent, instead of the ANT-specific class
loader. That way, it sees all the system classes normally, and none of the
ANT classes. Voila! Of course, I'm assuming proper delegation behavior of
all these class loaders.

I guess alternatively, instead of having to bypass the AppClassLoader for
ANT, you could make the parent class loader of the <java> CL the extension
class loader.

As pointed out, that doesn't solve issues, like playing with System.out, or
use of System.exit(), but it would solve the problem I am seeing.


-----Original Message-----
From: Conor MacNeill [] 
Sent: Sunday, May 19, 2002 8:19 PM
To: Ant Developers List
Subject: Re: FW: Problem with ANT classloader?

Dominique Devienne wrote:
> Don't any of the ANT experts out there have any clue what's going on here?
> --DD

Sure, but sometimes I find other things to do on my weekend :-)

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message