【发布时间】:2025-12-28 18:45:11
【问题描述】:
我创建了一个使用 google or-tools 的 spring 应用程序。为此,我使用 System.loadLibrary("jniortools") 导入 jniortools。当我提供 .dll 文件并运行 war 文件时,它运行良好。但是当我在 lib 中提供 .so 文件路径时,我得到了 unsatisfiedlinkerror。
【问题讨论】:
我创建了一个使用 google or-tools 的 spring 应用程序。为此,我使用 System.loadLibrary("jniortools") 导入 jniortools。当我提供 .dll 文件并运行 war 文件时,它运行良好。但是当我在 lib 中提供 .so 文件路径时,我得到了 unsatisfiedlinkerror。
【问题讨论】:
取自here,一个在 Intellij 上使用 or-tools 的解决方案:
要使用 Intellij(通过 Windows 机器)使其工作,您需要:
-Djava.library.path=<path to the lib folder that hold the jars>
通过将以下代码添加到您的类来静态加载 jni 库(如提到的here。)
static {
System.loadLibrary("jniortools");
}
【讨论】: