Message649
Logged In: NO
Here's a workaround. Import JythonClassPathMagic before
accessing the
java code in the jar file manifest Class-Path.
Jeff Emanuel
jemanuel@lgc.com
JythonClassPathMagic.py:
import java,sys
# This adds the class path elements specified in jar file
manifests to
# the jython package manager so the java packages and
classes listed
# in the manifests can be imported in jython.
def handleJarClassPath(jcp,parent):
for p in jcp.split():
f = java.io.File(parent,p)
if p[-1]=='/':
sys.packageManager.addDirectory(f)
else:
sys.packageManager.addJar(f.canonicalPath,1)
classpath=java.lang.System.getProperty('java.class.path')
for element in
classpath.split(java.lang.System.getProperty('path.separator')):
try:
jar = java.util.jar.JarFile(element)
if jar:
if jar.manifest:
jarAttrs = jar.manifest.mainAttributes
jarClassPath =
jarAttrs[java.util.jar.Attributes.Name.CLASS_PATH]
if jarClassPath:
f=java.io.File(element)
handleJarClassPath(jarClassPath,f.parentFile)
except java.io.IOException:
pass
|
|
Date |
User |
Action |
Args |
2008-02-20 17:17:05 | admin | link | issue547727 messages |
2008-02-20 17:17:05 | admin | create | |
|