From: <bc...@wo...> - 2001-02-16 14:54:57
|
[Sarwar Raza] >Hi.. >I posted a similar problem a few days ago. I have >tried adding the application specific jars to my >classpath (referring to the jars themselves and not >just their directories) but the jpyton interpreter >_will not_ pick them up. Strange, it works fine for me. Note that the name of the .jar files added to CLASSPATH envvar must be with lowercase ".jar". F.ex my classpath looks like this: CLASSPATH=i:\java\jdk1.3\jre\lib\rt.jar;i:\java\Jython.CVS\jython.jar;i:\java\in fobus1.2\infobus.jar;I:\java\jaxp1.0.1\jaxp.jar;i:\java\jaxp1.0.1\parser.jar;i:\ java\jakarta-tomcat-4.0-m5\bin\servlet.jar and the classes in all the .jars listed can be loaded as expected. >The only jars cached by the >package manager are those in the ..JRE/lib/ext >directory. This is a serious problem for me. Any help >would be much appreciated. > >Some additional detail: >the jpython modules are run within a jpython >interpreter embedded within the application. i.e. >there is no CLI. Can you load the classes from a command prompt? Does the application set its own classpath when starting and thus ignoring the CLASSPATH envvar? >I create a jpython interpreter object >and pass it the name of the module to run. If any of >these modules contain and 'import from' clause for a >package from a jar _not_ contained witin >../JRE/lib/ext, the package manager _will not_ pick >them up. I can go crazy importing java.util.Hashtable >or javax.util.Timer for example, but cannot import >from com.foo.bar unless foobar.jar is in >../JRE/lib/ext. I need to change this so that I can >load libs from a custom directory. As a workaround you can add the packages to the package cache by doing a sys.add_package("com.foo.bar") from within the python module before doing from com.foo.bar import Baz regards, finn |