ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: <script> needs a classpath param
Date Tue, 07 Aug 2001 05:36:58 GMT
On Mon, 6 Aug 2001, Sam Ruby <> wrote:

> What's a "context" class loader?

Since JDK 1.2 you can associate a classloader with a thread as a sort
of advice. If you cannot find a class using your classloader, you can
consult the context classloader, but there is nothing that enforces

> My experience is that things loaded by a class loader do have access
> to objects created under other class loaders.

The problem Paul describes is as follows: BSF and Rhino and whatever
get loaded via the system classloader, as long as they are in
CLASSPATH or ANT_HOME/lib. This will still be true if you add a nested
classpath element to <script> due to the delegation model of
classloaders (classloaders in JDK 1.2+ are supposed to consult the
parent classloader first, in JDK 1.1 they have to consult the system
classloader first).

If you script now wants to load classes from a different classpath
(specified via <classpath> or whatever), BSF cannot load them, as it
doesn't have access to this other classloader.  If it was context
classloader aware, there was at least a workaround for JDK 1.2+.

> My only comment on the requirement for a <classpath> is that such
> support should respect the value of build.sysclasspath,

Of course 8-)


View raw message