Decision Optimization

Expand all | Collapse all


  • 1.  java.lang.UnsatisfiedLinkError

    Posted Wed February 05, 2020 02:29 PM

    Originally posted by: DeFersen


    I try to launch a java application on my Mac with cplex.jar in the build path but i have this error :


    java.lang.UnsatisfiedLinkError: no cplex1280 in java.library.path: [/Users/axel/Library/Java/Extensions, /Library/Java/Extensions, /Network/Library/Java/Extensions, /System/Library/Java/Extensions, /usr/lib/java, .]
    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(
            at ilog.cplex.CplexI.<init>(
            at ilog.cplex.IloCplex.<init>(
            at ilog.cplex.IloCplex.<init>(
            at NSP.<init>(
            at Main.main(

    Could you please help me ?



  • 2.  Re: java.lang.UnsatisfiedLinkError

    Posted Wed February 05, 2020 06:03 PM

    Originally posted by: DeFersen

    Thanks for answer.

    I'm on Eclipse and i don't use at all the command line but i will tell how i suceed in resolving my problem :

    1.You were right when you say that the .jar has being found but not the corresponding .bin files (called by the functions in the .jar). So i had to find the place where they were and indicate it to Eclipse.

    2. The bin. files on my mac where at the location : Application/CPLEX_Studio128/opl/bin/x86-64_osx. These files have either the extension .dylib or .jnilib.

    3. On Eclipse, right-click on the project/ Build Path/ Configure Build Path/ Librairies/ Click on 'Native Libray Location'/ Click on 'Edit' (on the right side)/ External Folder and then i put the location above.

    Apply and Clode, then the project works !


  • 3.  Re: java.lang.UnsatisfiedLinkError

    Posted Wed February 05, 2020 03:20 PM

    The CPLEX jar file is being found, but the program cannot find the CPLEX binary executable files. On Linux, these files mostly have names that start with 'libcplex' and end with the extension '.so'. On a Linux system, they would be found in <place where CPLEX is installed>/cplex/bin/x86-64_linux/. Presumably the path on a Mac will be different but somewhat similar.

    In particular, note that you cannot run a Java program using CPLEX if you just have the program files and the cplex.jar file. You need to have the CPLEX binaries installed as well.



  • 4.  Re: java.lang.UnsatisfiedLinkError

    Posted Wed February 05, 2020 03:18 PM

    As the error says, you'll need to set java.library.path to the directory where the cplex1280.dylib shared library is located.

    When you install CPLEX Optimization Studio there are examples and a Makefile that will show you exactly what you need to use on the command line. You can run the examples, like so (where <COSDIR> is the directory where CPLEX Optimization Studio is installed):

    cd <COSDIR>/cplex/examples/x86-64_osx/static_pic
    make execute_java

    This will compile the examples and execute them.

    On Linux, I see something like this when the LPex1 example is executed:

    java  -d64 -Djava.library.path=../../../bin/x86-64_linux -classpath ../../../lib/cplex.jar: LPex1 -r

    If you're using an IDE like Eclipse, you'll need to set up your project so that it uses the corresponding options.

  • 5.  RE: Re: java.lang.UnsatisfiedLinkError

    Posted Mon August 23, 2021 09:41 AM

    I followed Axel's instructions and it worked perfectly! Thank you.


    Gonzalo Salazar