簡體   English   中英

Jython Jar依賴項導入失敗

[英]Jython Jar Dependency Import Failure

我在這取決於不同的罐子庫寥寥罐子的應用程序。

這里是我的問題:當我輸入只是我的主應用程序文件,Jython的似乎正確加載的類,但抱怨通過NoClassDefError缺少類(在支持的jar包的一個表現之一)。

但是,如果我現在將該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()

謝謝!

聽起來很愚蠢,這是某種特殊的語法錯誤。 jar規范之間必須使用逗號:

"dist/MSMExplorer.jar",
"dist/lib/prefuse.jar" 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM