私は仕事でいくつかのレガシーコードを扱っています。Jythonを介してコード内のPythonスクリプトを実行しようとすると、UnsatisfiedLinkErrorが発生します。「-D」オプションを使用してjava.class.pathオプションを設定しようとしましたが、問題が解決しないようです。次の例では、Durandal.jar
はC:\scm\main\core\isidurandal\durandal\build
"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を実行しようとすると問題になる可能性があるようです。それが事実であることが判明した場合、私は私の質問を修正します。