我一直在 Eclipse 中使用 IBM OPL Java API 库在 Java 中运行我的 OPL 模型和数据文件。这在 Eclipse 中运行良好,但现在我已将程序编译为可执行 jar 并尝试在 Windows 7 命令行上运行它,但出现错误。我自己的所有代码都运行良好,直到包含 ilog.opl.IloOpl 对象的第一行,即出现以下错误:
No version in manifest (not in a jar?), trying 1260
No version in manifest (not in a jar?), trying 1260
Native code library failed to load: ensure the appropriate library (opl1260.dll/.so) is in your path.
Exceptions:
no opl1260 in java.library.path
no opl_lang_wrap_cpp in java.library.path
no opl_core_wrap_cpp_java1260 in java.library.path
no opl_core_wrap_cpp in java.library.path
no cp_wrap_cpp_java1260 in java.library.path
no cp_wrap_cpp in java.library.path
no concert_wrap_cpp_java1260 in java.library.path
no concert_wrap_cpp in java.library.path
It might also be related to missing Microsoft Visual C++ Redistributable Package.
Exception in thread "main" java.lang.ExceptionInInitializerError
at ilog.concert.cppimpl.concert_wrap.setDebugWrappers(concert_wrap.java:18)
at ilog.opl.IloOplFactory.setDebugMode(IloOplFactory.java:156)
at Simulator.SimManager.solve(SimManager.java:422)
at Simulator.SimManager.runScaleTests(SimManager.java:133)
at Simulator.SimManager.main(SimManager.java:105)
Caused by: java.lang.RuntimeException: Native code library failed to load: ensure the appropriate library (opl1260.dll/.so) is in your path.
Exceptions:
no opl1260 in java.library.path
no opl_lang_wrap_cpp in java.library.path
no opl_core_wrap_cpp_java1260 in java.library.path
no opl_core_wrap_cpp in java.library.path
no cp_wrap_cpp_java1260 in java.library.path
no cp_wrap_cpp in java.library.path
no concert_wrap_cpp_java1260 in java.library.path
no concert_wrap_cpp in java.library.path
It might also be related to missing Microsoft Visual C++ Redistributable Package.
at ilog.concert.IloJNILoader.loadJNI(IloJNILoader.java:85)
at ilog.concert.cppimpl.concert_wrapJNI.<clinit>(concert_wrapJNI.java:15)
... 5 more
但奇怪的是……我有 Studio 12.6.1,而不是 12.6.0。我在 C:\Program Files\IBM\ILOG\CPLEX_Studio1261\opl\lib 中引用 OPLall.jar 文件,并且我的 PATH 也包含此文件夹。
我尝试谷歌搜索并遇到了这些相关问题=
不同之处在于,在这些问题中,程序似乎可以识别正确的版本。出于某种原因,我的程序正在寻找错误的文件夹和错误的文件(opl1260 不存在,但 opl1261.dll 就在文件夹中)。
OPLall.jar(我从 IBM 文件夹复制)清单包含以下内容:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: IBM Corporation
Specification-Title: IBM ILOG CPLEX OPTIMIZATION STUDIO Java API
Specification-Version: 12.6
Specification-Vendor: IBM
Implementation-Title: IBM ILOG CPLEX OPTIMIZATION STUDIO Java API
Implementation-Version: 12.6.1.0
Implementation-Vendor: IBM
Build-Date: 2014-11-18
有谁知道如何解决这个问题?
编辑:我还重新安装了 Microsoft Visual C++ 2010 SP1 Redistributable Package (x64),因为错误日志中提到了这一点,但这并没有改变问题。我也尝试重新安装 IBM Studio,但同样的问题。