Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Cplex library path in Maven (java) POM.xml file!

    Posted Fri April 15, 2016 07:54 AM

    Originally posted by: ASMKhan


     

    Dear all,

     

    I am using maven to build my jjava project. I am trying to give:

     

    -Djava.library.path=/opt/ibm/ILOG/CPLEX_Studio1262/cplex/bin/x86-64_linux

     

    as an argument in the POM file of my maven/java project. I have already added the following lines to the dependencies of my project:

     

    <dependency>

    <groupId>cplex</groupId>
    <artifactId>cplex</artifactId>
    <version>12.6.2</version>
    </dependency>

    I keep getting this error whenever the code using cplex is about to run: 

    java.lang.UnsatisfiedLinkError: no cplex1262 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=...
    java.lang.UnsatisfiedLinkError: ilog.cplex.Cplex.CPXopenCPLEX([I)J
        at ilog.cplex.Cplex.CPXopenCPLEX(Native Method)
        at ilog.cplex.CplexI.init(CplexI.java:6608)
        at ilog.cplex.CplexI.<init>(CplexI.java:629)
        at ilog.cplex.IloCplex.<init>(IloCplex.java:10313)
        at ilog.cplex.IloCplex.<init>(IloCplex.java:10328)

    Can someone please help me. What code should I put in my POM file and where in order to get rid of this error. 

    Thanks you so much. 


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Cplex library path in Maven (java) POM.xml file!

    Posted Fri April 15, 2016 11:17 AM

    I see that you've edited your post a bit (I started by looking at the original text via email).  It seems you are mixing versions of CPLEX (12.4 and 12.6).  As of now, you still have a reference to 12.4 above in the POM file snippet.  I can't help with maven specifically, but I'd make sure you are using the correct cplex.jar file (should be under /opt/ibm/ILOG/CPLEX_Studio1262/cplex/lib, for 12.6), and that you don't have any mixing of versions anywhere else.

    Finally, it looks like you're using a 64-bit installation (i.e., from x86-64_linux above).  I think you'll want to use the -d64 switch for java.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Cplex library path in Maven (java) POM.xml file!

    Posted Fri April 15, 2016 11:39 AM

    Originally posted by: ASMKhan


    I am sorry for the mistake.... i was looking at another file and I think I copied the text from there. Now I have corrected that. I am indeed using the same version of cplex and I have made sure that i am using the correct jar file. Still doesnt work.... I already have d64 switch for java.....

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Cplex library path in Maven (java) POM.xml file!

    Posted Tue April 11, 2017 09:11 AM

    Originally posted by: brave_hu


    Did you solve the problem?I encountered the same question.


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Cplex library path in Maven (java) POM.xml file!

    Posted Tue April 11, 2017 10:29 AM

    Originally posted by: ASMKhan


     

    I couldnt find a way to put the cplex library path in the pom file, so I did a work around by changing the java environment variable.


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Cplex library path in Maven (java) POM.xml file!

    Posted Tue April 11, 2017 10:34 AM

    Originally posted by: brave_hu


    thanks for your reply!Can you tell me  more details ?


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Cplex library path in Maven (java) POM.xml file!

    Posted Tue April 11, 2017 10:38 AM

    Originally posted by: ASMKhan


     

    1) open the bash.bashrc file in the etc folder in edit mode

    2) add this line to the very end:

        export LD_LIBRARY_PATH=/opt/ibm/ILOG/CPLEX_Studio12xx/cplex/bin/x86-64_Linux

    3) you are good to go


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Cplex library path in Maven (java) POM.xml file!

    Posted Tue April 11, 2017 10:41 AM

    Originally posted by: brave_hu


    Idea thank you very much! I will try it out .


    #CPLEXOptimizers
    #DecisionOptimization