From: Phil S. <psu...@es...> - 2001-12-21 15:31:36
|
Here is a really good article explaining how java2 classloading works: http://www.javageeks.com/Papers/ClassForName/ClassForName.pdf I read this a while ago, but: In short, classes from extensions can only access classes in the boot class path (which is usually only rt.jar). Classes in the 'normal' classpath cannot be seen from an extensions. IMO, extensions are evil. -----Original Message----- From: bc...@wo... [mailto:bc...@wo...] Sent: Monday, November 26, 2001 11:34 AM To: jyt...@li... Subject: [Jython-users] Re: Import strange error >| My guess is that jython.jar exists in jre/lib/ext and that is the reason >| that jython can only load other code that also reside on the >| boot-classpath. > >Yes it actually is. I put everything I need in the jre/lib/ext dir to=20 >avoid classpath problems. Is there a side effect of putting jython in=20 >this directory? It seems like the classloader that is loading extentions does not itself search the classpath. I can't find a place in the Java documentation stating that it is the case, but you can verify that it is by putting your Test.class in a .jar file and copy the jar file to jre/lib/ext. I predict that the Test program also fails then. >I cannot see why putting the jython.jar in this=20 >directory would prevent to load classpath items physically located=20 >elsewhere? It is the classloader that loaded the jython.jar that decides. When running with jython.jar in my jre/liv/ext, I get see that it is an ExtClassLoader that loaded jython. Jython 2.1b1 on java1.4.0-beta3 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> import org >>> org.python.core.Py.classLoader sun.misc.Launcher$ExtClassLoader@9fef6f >>> I get: >>> *sys-package-mgr*: processing new jar,=3D20 >>> = >'/Users/spierre/Projects/SPEdit/prototype/build/SPEdit.app/Contents/Resour= >=3D >>> ces/Java/SPEdit.jar' >> >> Hmm, that output can't be from your little java program. > >Well I did not put anything else than the program. The jython.jar seems >to be automatically loaded and processes the classpath items. Yuck. >I think >even if the -cp option is specified the jvm goes looking into the=20 >/jre/lib/ext. This is strange but understandable... That part is documented: http://java.sun.com/docs/books/tutorial/ext/basics/load.html regards, finn _______________________________________________ Jython-users mailing list Jyt...@li... https://lists.sourceforge.net/lists/listinfo/jython-users |