Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  java.lang.UnsatisfiedLinkError

    Posted 02/19/19 02:36 PM

    Originally posted by: DeFersen


    Hi,

     

    I just get a new computer (a MacBookAir) and I would like to use culex with Java as I use to on my old computer with windows.

    I have created a project on Eclise, imported the good libraires (cplex.jar, oplall.Jar) and tried to execute my projet containing this line : IloCplex cp = new IloCplex();

    I got this error : 

    java.lang.UnsatisfiedLinkError: no cplex1280 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:6834)
            at ilog.cplex.CplexI.<init>(CplexI.java:785)
            at ilog.cplex.IloCplex.<init>(IloCplex.java:10154)
            at ilog.cplex.IloCplex.<init>(IloCplex.java:10169)
            at Modele.<init>(Modele.java:42)
            at Modele.main(Modele.java:52)
    

    I'm trying to resolve this error for 2 days without success... I have watched a lot of topics about this but none of them helped me.

    I have already tried :

    • Change the order of the librairies in "Order and Export" of the Java Build Path project.
    • Change the "Native library location" of each of the library to point not only on "/Applications/CPLEX_Studio128/cplex/lib/" but also "/Applications/CPLEX_Studio128/cplex/lib/x86-64_osx" and "/Applications/CPLEX_Studio128/cplex/lib/x86-64_osx/static_pic". The same for oplall.jar.
    • Put this line as first in the code : System.setProperty("java.library.path", "/Applications/CPLEX_Studio128/cplex/lib/");

    But none of these alternatives works... Note that : 

    • I choose Java SE 1.8.201 instead of 11.0.1 for precautions but I have already tried with 11.0.1 and it didn't work.
    • As I'm a new user of Mac, I have never used to write command line so I couldn't be able to execute this command : java -Djava.library.path=/Applications/CPLEX_Studio128/cplex/bin/ as it explained in this topic : https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014468725 for the simple reason that is when I enter this command, it shows me the use of the command (with the help) but it does anything. 
    • Something interesting, when I write this command : java -Djava.library.path=/Applications/CPLEX_Studio128/cplex/bin/ -jar cplex.jar, I get this : 

      Error: Could not find or load main class java.library.path=.Applications.CPLEX_Studio128.cplex.bin.

      Caused by: java.lang.ClassNotFoundException: java.library.path=.Applications.CPLEX_Studio128.cplex.bin.

    • Other thing which could maybe interest you, when I write this command : /usr/libexec/java_home, I get this : /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home.

    That's it, I hope to have described my problem correctly. If you need more information, please let me know.

    Thanks,

    Axel.


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: java.lang.UnsatisfiedLinkError

    Posted 02/19/19 07:38 PM

    The java.library.path property needs to point to the directory where the CPLEX shared library lives (i.e., libcplex1280.jnilib on OSX).

    Based on the paths you tried above, try setting the "Native library location" to /Applications/CPLEX_Studio128/cplex/bin/x86-64_osx in Eclipse.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: java.lang.UnsatisfiedLinkError

    Posted 02/20/19 02:50 AM

    A word of warning in addition to what Ryan said: If you use CP then don't import cplex.jar! Also, for oplall.jar you jave to point java.library.path to the directory where the OPL libraries live. This probably is /Applications/CPLEX_Studio128/opl/bin/x86-64_osx in your case.


    #CPLEXOptimizers
    #DecisionOptimization