0

I have an application in a jar that depends on a handful of libraries in different jars.

Here's my issue: when I import just my main application file, jython appears to load the class correctly, but complains about a missing class via a NoClassDefError (one expressed in one of the supporting library 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()

ありがとう!

4

1 に答える 1

0

ばかげているように聞こえるかもしれませんが、これはある種の特殊な構文エラーでした。jar 仕様の間にはコンマが必要です。

"dist/MSMExplorer.jar",
"dist/lib/prefuse.jar" 
于 2012-08-01T07:03:18.863 に答える