(A. Bolmarcich) wrote in message news:<>...
>
> Based on your description, all the following occurences of "Point" as
> a Java type should be "IPoint".
>
Yes. I was remembering the original example, and forget that I didn't
do that.
> > URL[] serverURLs = new URL[] { new URL
> > ("file:classes/subdir/"), new URL ("file:classes/") };
>
> You should only use the subdir URL. Using the second URL will have the
> URL class loader load the IPoint interface, which, as you described, is
> a different class than the one loaded the the class loader of PointServer.
> You want the URL class loader to delegate the loading of IPoint to
> the class loader that loaded PointServer.
Thank you very much for the clarification.
>
> More generally, you can use
>
> if (localClassLoader == null) {
> cl_ = new URLClassLoader (serverURLs);
> else
> cl_ = new URLClassLoader (serverURLs, localClassLoader);
> }
>
Ah. Good point. I actually added the longer version in when I couldn't
get the single argument to work. I thought that by providing the
parent, the URLClassLoader would somehow talk to the parent and find
the interface. As you point out, though, the parent is most likely
null.
So, after your mail I decided that the only unknown was Ant. I
immediately put javac and java in my path and did everything manually
.... ant it works.
So back to ant and I include fork="true" and all is well. I should've
thought of that. I guess that ant's classloader is somehow interfering
here ... Stuart implies tomcat, ant and junit do not write delegating
classloaders ... I wonder if that's causing this ...
http://staff.develop.com/halloway/we...02/14.html#a24
For those of you lost since I've provided so little code, here is a
version of the example I was trying to create:
http://developer.java.sun.com/develo...00/tt1027.html
Many thanks to both of you for your help. This opens quite a few doors
for me.
-Luther