Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

Difficulty running java cpoptimizer on Linux

  • 1.  Difficulty running java cpoptimizer on Linux

    Posted Tue May 24, 2016 12:54 PM

    Originally posted by: AdamGregory


    Hi there,

    I am having some difficulty installing and using cpoptimizer on Red Hat Linux installation.
    I have installed CPLEX Optimization studio 12.6.1 using the instructions listed here:
    http://www.ibm.com/support/knowledgecenter/SSSA5P_12.6.1/ilog.odms.studio.help/Optimization_Studio/topics/COS_installing.html

    I have created a simple java Class with a main method where I instantiate an object of type IloCP to test my installation.
    I successfully complied the java class file using javac and setting the classpath to /opt/ibm/ILOG/CPLEX_OPTIMIZER1261/cpoptimizer/lib/ILOG.CP.jar.
     

    When I try to execute the java main class after setting Djava.library.path to /opt/ibm/ILOG/CPLEX_OPTIMIZER1261/cpoptimier/bin/x86-64_linux/ I get the following error:
     

    Native code library failed to load: ensure the appropriate library (opl1261.dll/.so) is in your path.
    Exceptions:
    no opl1261 in java.library.path
    no opl_lang_wrap_cpp in java.library.path
    no opl_core_wrap_cpp_java1261 in java.library.path
    no opl_core_wrap_cpp in java.library.path
    /opt/ibm/ILOG/CPLEX_Studio1261/cpoptimizer/bin/x86-64_linux/libcp_wrap_cpp_java1261.so: libcplex1261.so: cannot open shared object file: No such file or directory
    no cp_wrap_cpp in java.library.path
    no concert_wrap_cpp_java1261 in java.library.path
    no concert_wrap_cpp in java.library.path
    
    Exception in thread "main" java.lang.ExceptionInInitializerError
     at ilog.concert.cppimpl.IloEnv.<init>(IloEnv.java:49)
     at ilog.concert.IloModelerImpl.<init>(IloModelerImpl.java:34)
     at ilog.cp.IloCP.<init>(IloCP.java:125)
     at ilog.cp.IloCP.<init>(IloCP.java:118)
     at test.TestMain.main(TestMain.java:11)
    Caused by: java.lang.RuntimeException: Native code library failed to load: ensure the appropriate library (opl1261.dll/.so) is in your path.
    Exceptions:
    no opl1261 in java.library.path
    no opl_lang_wrap_cpp in java.library.path
    no opl_core_wrap_cpp_java1261 in java.library.path
    no opl_core_wrap_cpp in java.library.path
    /opt/ibm/ILOG/CPLEX_Studio1261/cpoptimizer/bin/x86-64_linux/libcp_wrap_cpp_java1261.so: libcplex1261.so: cannot open shared object file: No such file or directory
    no cp_wrap_cpp in java.library.path
    no concert_wrap_cpp_java1261 in java.library.path
    no concert_wrap_cpp in java.library.path
    
     at ilog.concert.IloJNILoader.loadJNI(IloJNILoader.java:85)
     at ilog.concert.cppimpl.concert_wrapJNI.<clinit>(concert_wrapJNI.java:15)
     ... 5 more
    

    I do not see any opl1261.so in the installation directory. I can find libcplex1261.so under <install_dir>/opl/bin/x86-64_linux/ but adding that binary to the library path does not resolve the issue. I have tried reinstalling CPLEX optimization studio but the available binaries did not change. I had previously installed CPLEX optimization studio 12.5 on a windows machine and noticed that opl25.dll is among the installed dlls. What am I doing wrong?

    Thank you for your help in resolving this issue.


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 2.  Re: Difficulty running java cpoptimizer on Linux

    Posted Wed May 25, 2016 05:33 AM

    Originally posted by: Petr Vilím


    Hello,

    the error message is misleading. In fact the program is looking for libcp_wrap_cpp_java1261.so and libcplex1261.so. They could be found in cpoptimizer/bin/x86-64_linux and cplex/bin/x86-64_linux (assuming you have 64 bits installation). Path to those libraries could be specified by environment variable LD_LIBRARY_PATH.

    In the installation there are java examples that you can run. In directory cpoptimizer/examples/x86-64_linux/static_pic do for example "make Sports.run". It will compile examples/src/java/Sports.java and run it with the right LD_LIBRARY_PATH. Note that you need to specify JAVA_HOME.

    Best regards, Petr


    #DecisionOptimization
    #OPLusingCPOptimizer