UnsatisfiedLinkError, despite setting Djava.librar

2020-04-21 00:27发布

问题:

I am trying to integrate IBM's CPLEX library with my java application. For now, i'm just trying to create an IloCplex object. I added Cplex.jar, and it compiles fine, but when I run this:

public class cplexTest{
    public static void main(String[] args){
        try{
            IloCplex cplex = new IloCplex();
        }catch (Exception e){
            e.printStackTrace();
        }
}

Cplex prints this message before throwing an exception:

java.lang.UnsatisfiedLinkError: no cplex124 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=...

I pass this argument to the JVM: -Djava.library.path="C:\Program Files\IBM\ILOG\CPLEX_Studio124\cplex\bin\x64_win64. This is the location of cplex124.dll. Every tutorial i've seen gives the same steps, and i feel like i followed them pretty well.

What am I doing wrong??

回答1:

What I've found in the interwebs is that one possible cause for this problem is the dll being in 32 or 64 bits and your java being in the opposite architecture.

Try verifying that your java and cplex.dll match.