0
我正在使用一些遺留代碼。試圖通過Jython在我們的代碼中運行python腳本,我得到一個UnsatisfiedLinkError。我試圖使用「-D」選項來設置java.class.path選項,但它似乎不能解決問題。對於下面的例子,Durandal.jar
正在C:\scm\main\core\isidurandal\durandal\build
無法爲Jython設置java.library.path
"C:\Program Files\Java\jdk1.6.0_31\bin\java.exe" -Xint "-Dpython.path=c:\scm\main\core\isidurandal\durandal\scripts\lib" "-Dpython.home=c:\bin\jython2.5.2" "-Djava.library.path=c:\scm\main\core\isidurandal\durandal\build" -classpath "c:\bin\jython2.5.2\jython.jar;c:\scm\main\core\isidurandal\durandal\build\durandal.jar;c:\scm\main\core\isidurandal\japanese\build\durandalJapanese.jar;c:\scm\main\core\isidurandal\biometrics\build\MtiBiometrics.jar" org.python.util.jython tools\alignSequences.py
=========================================================
Monolithic library init failed with UnsatisfiedLinkError:
java.lang.UnsatisfiedLinkError: no durandal in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1738)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at com.interactivesys.durandal.base.Library.<clinit>(Unknown Source)
at com.interactivesys.durandal.recognition.Library.<clinit>(Unknown Sour
ce)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.python.core.Py.loadAndInitClass(Py.java:895)
at org.python.core.Py.findClassInternal(Py.java:830)
at org.python.core.Py.findClassEx(Py.java:881)
at org.python.core.packagecache.SysPackageManager.findClass(SysPackageMa
nager.java:133)
at org.python.core.packagecache.PackageManager.findClass(PackageManager.
java:28)
at org.python.core.packagecache.SysPackageManager.findClass(SysPackageMa
nager.java:122)
at org.python.core.PyJavaPackage.__findattr_ex__(PyJavaPackage.java:137)
at org.python.core.PyObject.__findattr__(PyObject.java:863)
at org.python.core.imp.import_name(imp.java:849)
at org.python.core.imp.importName(imp.java:884)
at org.python.core.ImportFunction.__call__(__builtin__.java:1220)
at org.python.core.PyObject.__call__(PyObject.java:357)
at org.python.core.__builtin__.__import__(__builtin__.java:1173)
at org.python.core.imp.importFromAs(imp.java:978)
at org.python.core.imp.importFrom(imp.java:954)
at org.python.pycode._pyx0.f$0(tools\alignSequences.py:18)
at org.python.pycode._pyx0.call_function(tools\alignSequences.py)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1261)
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:235
)
at org.python.util.jython.run(jython.java:247)
at org.python.util.jython.main(jython.java:129)
Traceback (most recent call last):
File "tools\alignSequences.py", line 1, in <module>
from com.interactivesys.durandal.recognition import Library
java.lang.UnsatisfiedLinkError: com.interactivesys.durandal.base.ResourceLocator
.resolvePath(Ljava/lang/String;)Ljava/lang/String;
at com.interactivesys.durandal.base.ResourceLocator.resolvePath(Native M
ethod)
at com.interactivesys.durandal.base.Library.<clinit>(Unknown Source)
at com.interactivesys.durandal.recognition.Library.<clinit>(Unknown Sour
ce)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.python.core.Py.loadAndInitClass(Py.java:895)
at org.python.core.Py.findClassInternal(Py.java:830)
at org.python.core.Py.findClassEx(Py.java:881)
at org.python.core.packagecache.SysPackageManager.findClass(SysPackageMa
nager.java:133)
at org.python.core.packagecache.PackageManager.findClass(PackageManager.
java:28)
at org.python.core.packagecache.SysPackageManager.findClass(SysPackageMa
nager.java:122)
at org.python.core.PyJavaPackage.__findattr_ex__(PyJavaPackage.java:137)
at org.python.core.PyObject.__findattr__(PyObject.java:863)
at org.python.core.imp.import_name(imp.java:849)
at org.python.core.imp.importName(imp.java:884)
at org.python.core.ImportFunction.__call__(__builtin__.java:1220)
at org.python.core.PyObject.__call__(PyObject.java:357)
at org.python.core.__builtin__.__import__(__builtin__.java:1173)
at org.python.core.imp.importFromAs(imp.java:978)
at org.python.core.imp.importFrom(imp.java:954)
at org.python.pycode._pyx0.f$0(tools\alignSequences.py:18)
at org.python.pycode._pyx0.call_function(tools\alignSequences.py)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1261)
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:235
)
at org.python.util.jython.run(jython.java:247)
at org.python.util.jython.main(jython.java:129)
java.lang.UnsatisfiedLinkError: java.lang.UnsatisfiedLinkError: com.interactives
ys.durandal.base.ResourceLocator.resolvePath(Ljava/lang/String;)Ljava/lang/Strin
g;
可我的理解是,當一個人試圖訪問一個庫,是不是在類路徑中,這個錯誤通常會發生,但我想我已經正確設置它命令行。再說一遍,我對Jython還不是很熟悉(對Java或Python不太熟悉),所以我有點在海上。
編輯:看起來這可能是一個嘗試在64位Java下運行32位DLL的問題。如果事實證明是這樣,我會修改我的問題。