Message1854
The problem here is actually with Jython's package scanner. To import packages directly, Jython needs to scan your jars at startup. It can handle that with jars on -cp, but it doesn't have a way to find the jars included from the manifest file of a jar given with -jar. Since it doesn't know what jars exist, it can't figure out what packages exist either.
There are a few ways you can work around this. If you import full Java classes, you won't need to worry about package scanning at all. Replace __import__('some.pack.test') with __import__('some.pack.test.PackageTest') and that code should work. Not relying on package scanning in Jython code has some advantages: the scanning takes some time so startup will be faster, and your code can run in restricted environments where jar scanning isn't possible.
You could also manually tell Jython where your jar is by adding it to sys.path. Jars on sys.path are scanned when an import occurs.
Finally, you could write a patch for Jython's package scanner to tell it how to find jars from the manifest. I'm not sure if jars from the manifest are made available to the JVM at runtime, so this may not be possible. But if it is, it shouldn't be too difficult to add another hook into the package scanner to look for those jars and scan them automatically. |
|
Date |
User |
Action |
Args |
2008-02-20 17:17:59 | admin | link | issue1778514 messages |
2008-02-20 17:17:59 | admin | create | |
|