From: <Mat...@i2...> - 2001-12-20 21:32:45
|
Is there an easy way to dynamically change the classpath that jython uses to resolve Java symbols? i.e. If I started the jython interpreter using a classpath that didn't contain foo.jar, but I need foo.jar in the classpath to resolve com.foo.Foo, how would I add foo.jar to the classpath before execing a script that needs it? I know I can use the jreload module, but its slow and forces an extra module to the front of the import of the java package. What I'd like is to be able to tell the interpreter to use a different classpath/classloader for resolving. bar.py: print "in bar" setcp("/path/to/foo.jar") execfile("foo.py") foo.py: print "in foo" from com.foo import Foo f = Foo() |