GLPK java java.lang.UnsatisfiedLinkError:找不到依赖库

时间:2015-04-28 15:23:25

标签: java unsatisfiedlinkerror glpk

无法加载GLPK for Java的动态链接库。 考虑使用

java -Djava.library.path=
The current value of system property java.library.path is:
\\MILP\lib\glpk-4.55\w64
Exception in thread "main" java.lang.UnsatisfiedLinkError: 
\\MILP\lib\glpk-4.55\w64\glpk_4_55_java.dll: Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at org.gnu.glpk.GLPKJNI.<clinit>(GLPKJNI.java:24)
    at org.gnu.glpk.GLPK.glp_version(GLPK.java:2259)
    at TestMain.main(TestMain.java:7)
  1. 我添加了正确的JAR文件
  2. 我已经为库提供了正确的原生路径
  3. 问题仍然存在,

    我怀疑的是\ MILP \ lib \ glpk-4.55 \ w64 \ glpk_4_55_java.dll文件存在缺陷。我使用dependencyWalker检查了它,它显示了一些警告

    Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
    Error: Modules with different CPU types were found.
    

    任何线索都将受到赞赏

2 个答案:

答案 0 :(得分:5)

我也面临同样的问题。我将glpk_4_55.dll和glpk_4_55_java.dll复制到C:\ Windows \ System32,一切正常。

答案 1 :(得分:1)

您可以将C:\ Program Files \ GLPK \ glpk-4.55 \ w64文件夹添加到PATH环境变量

按照Pradeepb的建议将glpk_4_55.dll和glpk_4_55_java.dll复制到C:\ Windows \ System32