From: Kip L. <kip...@ea...> - 2007-03-13 15:02:25
|
My environment: Windows XP, JDK 1.5, Jython 2.2b In a February 2007 Jython Monthly article, Steve Langer presented a means of altering the class path at runtime based on a translation of some Java code (which addressed the same problem). I tested out the Jython approach using a jar named pop3.jar which had some classes in a com.sun.mail.pop3 package. Interestingly, while the approach worked from the standpoint of not generating any exception, I wasn't able to import the package. It turns out that the java.net.URLClassLoader has a method named 'getURLs' in addition to the 'addURL' method (used to add the target jar / load classes in the target jar). After calling the 'addURL' method via method.invoke and then calling the 'getURLs' method via the same technique, my target jar shows up in the result. But still, no joy in importing the package. I tried this with 2 other jar files and observed a similar result. Can anyone shed any light on what is happening? And how to get to the point where an import of the package covered by the target jar is successful? thanks, -- Kip Lehman kipster<dash>t<at>earthlink<dot>net |