Google OR-Tools: Could not run the java example, java.lang.UnsatisfiedLinkError: no jniortools in java.library.path

OR-Tools is a C++ library with wrapper in Java using SWIG (which do JNI call etc...). I.e. this is a native library not a "pure" java lib...

So to use ortools in java you must tweak the java.library.path e.g. when using ortools from source and running a program from root_dir:

make third_party
make java
java -Djava.library.path=lib -cp objs:lib/com.google.ortools.jar:lib/protobuf.jar Program

note: ortools depends on protobuf.jar (which is compiled by ortools makefile third_party target rules)

documentation: https://developers.google.com/optimization/introduction/run_programs#running-the-java-example

Tags:

Java

Or Tools