我在jar中有一个应用程序,它依赖于不同jar中的少数几个库。
这就是我的问题:当我只导入我的主应用程序文件时,jython似乎正确地加载了类,但却通过NoClassDefError (在支持的库jars中表示的jars)抱怨缺少类。
但是,如果我现在将jar添加到类路径中,Jython将无法再找到原始导入,并会报错:ImportError: No module named edu
我的代码:
import sys
def setClassPath():
libDir = "/Users/gestalt/Documents/msmexplorer_git/msmexplorer/MSMExplorer/"
classPaths = [
"dist/MSMExplorer.jar"
"dist/lib/prefuse.jar" #the missing class is here, but this line causes package edu to go missing
]
for classPath in classPaths:
sys.path.append(libDir+classPath)
def runJavaClass():
from edu.stanford.folding.msmexplorer import MSMExplorer
me = MSMExplorer()
def main():
setClassPath()
runJavaClass()
if __name__ == "__main__":
main()谢谢!
发布于 2012-08-01 15:03:19
这听起来可能很愚蠢,但这是某种特殊的语法错误。jar规范之间必须使用逗号:
"dist/MSMExplorer.jar",
"dist/lib/prefuse.jar" https://stackoverflow.com/questions/11753803
复制相似问题