Google OR tools

324 Views Asked by At

I am learning to solve some optimisation programs using google or-tools. I started with their example code and I an trying to run it in intellij. But when I write the code and compile I get the following error.

Exception in thread "main" java.lang.UnsatisfiedLinkError: com.google.ortools.linearsolver.operations_research_linear_solverJNI.MPSolver_CLP_LINEAR_PROGRAMMING_get()I
    at com.google.ortools.linearsolver.operations_research_linear_solverJNI.MPSolver_CLP_LINEAR_PROGRAMMING_get(Native Method)
    at com.google.ortools.linearsolver.MPSolver$OptimizationProblemType.<clinit>(MPSolver.java:221)

I searched for some answers and I found that it requires jniortools.dll . But I am working with ubuntu. Hence i assume i need to load the libjniortools.so file , am I right?. So I included the line

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

and I have a lib folder wherein I have put both com.google.ortools.jar and protobuf.jar along with all the other lib files that were present when I extracted the zip file(basically copy pasted the lib folder from extracted zip file).

I have added the jar paths in intellij as shown in figure enter image description here

*the last 2 line of dependency in image

Then I have also tried giving the lib path in VM-options: -Djava.library.path=/home/surajvashistha/IdeaProjects/LPModel/lib

After all this, I get the following error

Exception in thread "main" java.lang.UnsatisfiedLinkError: no libjniortools in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
    at java.lang.Runtime.loadLibrary0(Runtime.java:871)
    at java.lang.System.loadLibrary(System.java:1124)
    at LP.<clinit>

I am stuck here and not able to move forward. Can anyone help?

0

There are 0 best solutions below