Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  java and cplex

    Posted 03/06/12 03:31 AM

    Originally posted by: SystemAdmin


    Hello
    I have a problem with adding cplex.jar to my java project. I installed the new Lion OX and I used to add the cplex.jar to my java projects easily when I had snow leopard, but now when I add the jar file and run the program I get the following error:

    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=...
    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:5722)
    at ilog.cplex.CplexI.<init>(CplexI.java:611)
    at ilog.cplex.IloCplex.<init>(IloCplex.java:10384)
    at test.main(test.java:15)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

    I even installed the cplex 12.4 and I use intelidea as an IDE for my java. Do you have any ideas?
    #DecisionOptimization
    #MathematicalProgramming-General


  • 2.  Re: java and cplex

    Posted 03/06/12 04:33 AM

    Originally posted by: SystemAdmin


    What is the value of your java.library.path property? Does it point to the folder that contains the cplex124 shared object?
    #DecisionOptimization
    #MathematicalProgramming-General


  • 3.  Re: java and cplex

    Posted 03/06/12 01:49 PM

    Originally posted by: SystemAdmin


    yes, after I added the cplex.jar, I expand the arrow on the left side and set the native location library to the cplex lib path
    #DecisionOptimization
    #MathematicalProgramming-General


  • 4.  Re: java and cplex

    Posted 03/07/12 03:04 AM

    Originally posted by: SystemAdmin


    Do the Java examples shipped with CPLEX work?
    To test this do (replace /path/to/COS/installation, PORT and SYSLIB appropriately)
    
    cd /path/to/COS/installation/cplex/examples/PORT/SYSLIB make execute_java
    

    Does this work? Is this able to run the Java examples? Or do you get the same error message?
    #DecisionOptimization
    #MathematicalProgramming-General


  • 5.  Re: java and cplex

    Posted 05/08/12 02:34 AM

    Originally posted by: MarioWinter


    I've got the same problems on Mac OS. I even can't locate the shared library cplex124.so in any of the ILOG installation directories. Where is it or where should it be???
    #DecisionOptimization
    #MathematicalProgramming-General


  • 6.  Re: java and cplex

    Posted 05/08/12 02:40 AM

    Originally posted by: SystemAdmin


    On MacOS the extension for the shared library is '.jnilib' instead of '.so'. It should be in directory INSTALLROOT/cplex/bin/x86-64_darwin9_gcc4.0 (or INSTALLROOT/cplex/bin/x86_darwin9_gcc4.0 for 32bit systems).
    #DecisionOptimization
    #MathematicalProgramming-General


  • 7.  Re: java and cplex

    Posted 05/08/12 09:31 AM

    Originally posted by: MarioWinter


    Thanx, found it! The delivered make worked anyway, and the java examples run from the shell. Unfortunately, I dont get them compiled and executed with eclipse - the cplex124 lib not found error still exists. Maybe it's a configuration problem with jre and 32/64 bit or the eclipse internal compiler doesn't get the calls right?
    #DecisionOptimization
    #MathematicalProgramming-General


  • 8.  Re: java and cplex

    Posted 05/09/12 01:47 AM

    Originally posted by: SystemAdmin


    Did you set the java.library.path properly? In the run configuration you need a VM argument like
    
    -Djava.library.path=/path/to/folder/with/lib
    

    It may be that the virtual machine started by eclipse is different from the virtual machine you use on the command line. Maybe try the 32bit version of the CPLEX library and also the 64bit version of it.
    #DecisionOptimization
    #MathematicalProgramming-General


  • 9.  Re: java and cplex

    Posted 05/09/12 01:48 AM

    Originally posted by: SystemAdmin


    By the way, there is a technote/FAQ about how to setup eclipse with CPLEX here.
    #DecisionOptimization
    #MathematicalProgramming-General