ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yves Martin <>
Subject How can I get the ClassLoader that loaded a URI ?
Date Thu, 25 Nov 2004 15:35:53 GMT


 I'm creating complex tasks with Ant and my problem can sumup to the question
 in subject.

 What I'm trying to do:

 1.  a.jar loaded in 'uri:a' with a 'loadclass' task declared. 'loadclass' will
     work with implementation of 'mycontract' interface.

   If I use <a:loadclass name="myclass" xmlns:a="uri:a"/> with myclass included
   in a.jar and implementing the 'mycontract' interface, it works - I use a
   simple Class.forName to get it.

 2. b.jar loaded in 'uri:b' with another class 'bclass', implementing

   <a:loadclass name="bclass" xmlns:a="uri:a"/> does not work. Of course,
   bclass.class is not in 'loadclass' ClassLoader - so Class.forName is not

 I would like to improve my task to do:
   <a:loadclass name="bclass" sourceuri="uri:b" xmlns:a="uri:a"/>

 That's way, 'loadclass' can lookup for the "uri:b" ClassLoader and loads

 How can I lookup for a URI ClassLoader ? Thanks in advance.

 'myclass' and 'bclass' are not tasks but simple POJO. If they were tasks, it
 is "easy" to execute them from its respective URI. I'm looking for a way to
 keep them POJO.

 Best regards,
Yves Martin

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

View raw message