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

pham cuong :

I a newbie in java, I wanna try google or-tools for vehicle routing problem

Just try to run java example from here

But I got this exception: java.lang.UnsatisfiedLinkError: no jniortools in java.library.path

There is a line of code which load system lib "jniortools". But I don't know where to get that lib.

I'm using mac osx.

Any ideas?

Mizux :

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

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=462222&siteId=1