0

I have created a spring application which uses google or-tools. For that, I am importing jniortools using System.loadLibrary("jniortools"). when I provide the .dll file and run the war file it runs perfectly. But when I provide the .so file path in lib, I get the unsatisfiedlinkerror.

1 Answers1

1

Taken from here, a solution for using or-tools over Intellij:

To make it work using Intellij (over a windows machine) you need to:

  1. Install Microsoft Visual C++ Redistributable for Visual Studio
  2. Download and extract the OR-Tools library for Java
  3. In intellij, add jar dependency to the 2 jars under the lib folder of the extracted files (each of the 2 jars separately, do not add to lib folder itself. This is why).
  4. Add the lib library path to VM options. In Intellij edit your run-configuration and add to vm options: -Djava.library.path=<path to the lib folder that hold the jars>
  5. Load the jni library statically by adding the below code to your class (as mentioned here.)

    static { System.loadLibrary("jniortools"); }

forhas
  • 11,551
  • 21
  • 77
  • 111