Search code examples
javaeclipsepathcplexunsatisfiedlinkerror

CPLEX library path error in eclipse


I'm using eclipse for java coding

I completed the code and it worked well on CPLEX library 12.6(I added library in properties> libraries > add external jars > cplex.jar)

I wanted to change the library of CPLEX 12.7, so I removed previous one and added cplex.jar of CPLEX 12.7, but suddenly I got error message.

It says as below;

java.lang.UnsatisfiedLinkError: no cplex1270 in java.library.path
java.library.path must point to the directory containing the CPLEX shared 
library
try invoking java with java -Djava.library.path=...
Exception in thread "main" java.lang.UnsatisfiedLinkError: 
ilog.cplex.Cplex.CPXopenCPLEX([I)J
    at ilog.cplex.Cplex.CPXopenCPLEX(Native Method)
    at ilog.cplex.CplexI.init(CplexI.java:6736)
    at ilog.cplex.CplexI.<init>(CplexI.java:746)
    at ilog.cplex.IloCplex.<init>(IloCplex.java:10303)
    at ilog.cplex.IloCplex.<init>(IloCplex.java:10318)
    at ColumnGen$MasterProblem.createModel(ColumnGen.java:222)
    at ColumnGen$MasterProblem.<init>(ColumnGen.java:196)
    at ColumnGen.<init>(ColumnGen.java:648)
    at main_BnP_MU.<clinit>(main_BnP_MU.java:8)

How can I overcome this?


Solution

  • The stack trace contains (Native Method): probably you missed to specify the native library location, the location of the .dll (Windows) or .so (Linux) file:

    1. In the project properties dialog, go to Java Build Path > Libraries
    2. Expand the CPLEX 12.7 JAR node
    3. Select the subnode Native library location: (None) and click Edit...