From: Kevin J. B. <kev...@bi...> - 2002-04-22 19:31:45
|
Frank, Please don't crosspost between jython-dev and jython-users. The lists are separate to facilitate separate discussions (Development of Jython, vs. use of Jython). Frank Cohen wrote: [ adding .jar file to sys.path doesn't work ] > Jython does not throw this AttributeError when testnetwork.jar IS on the > classpath. The a object is instantiated correctly. > > Any ideas what is going wrong? Jython doesn't automatically load Java classes from sys.path - only from the Java class path. You can use the jreload module to get what you want: >>> import jreload >>> jreload.makeLoadSet( "myset", ["d:/temp/testnetwork.jar"] ) <java load-set myset> >>> import myset >>> dir( myset.net.testnet ) ['__name__', 'testit'] >>> a = myset.net.testnet.testit() I'm ready >>> a.drinkme() 'That was good.' >>> And this should give you reloading as well, though that hasn't worked well for me. Note also that there is a bug in 2.1 that large classes cause failures when using jreload - search the dev mailing list for details - I'm not sure if the patch has been integrated into CVS yet or not. kb |