Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

Missing DLL in CP Optimizer 2.3 for Windows?

  • 1.  Missing DLL in CP Optimizer 2.3 for Windows?

    Posted Tue February 09, 2010 05:19 PM

    Originally posted by: SystemAdmin


    I am trying to use the Java bindings for CP Optimizer 2.3 but cannot seem to run my program. The error I get is:

    Native code library failed to load: ensure the appropriate library (oplXXX.dll/.so) is in your path.Exceptions:
    java.lang.UnsatisfiedLinkError: no opl23 in java.library.path
    java.lang.UnsatisfiedLinkError: no opl_lang_wrap_cpp in java.library.path
    java.lang.UnsatisfiedLinkError: C:\ILOG\CPOptimizer23\bin\x86_win32\cp_wrap_cpp_java23.dll: Can't find dependent libraries
    java.lang.UnsatisfiedLinkError: no concert_wrap_cpp_java23 in java.library.path

    Has anyone else successfully been able to write Java code against CP Optimizer? It looks like the Windows package is missing some files.
    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: Missing DLL in CP Optimizer 2.3 for Windows?

    Posted Wed February 10, 2010 04:31 AM

    Originally posted by: SystemAdmin


    Hello Alex.

    I got the same error message when I tried to compile CP Optimizer examples in 32bits on 64bits Linux machine. Maybe there is the same problem in Windows.

    CP Optimizer comes with Java examples. Sources of these examples are in examples/src/java. To build them, define your JAVA_HOME environment variable and go to the directory examples/AAA/BBB/ where AAA and BBB depends on your platform. There is build.xml file which you can use to build the examples by ant.

    If it still doesn't work, could you give us more information about your platform? Whether it is 32 or 64 bits, version of Windows and Java?

    Best Regards, Petr
    #CPOptimizer
    #DecisionOptimization


  • 3.  Re: Missing DLL in CP Optimizer 2.3 for Windows?

    Posted Wed February 10, 2010 07:17 AM

    Originally posted by: SystemAdmin


    Hi Petr,

    Thanks for pointing out the build.xml file. When I run this with ant I get the same error as before:

    run:
    echo Running Color
    java Native code library failed to load: ensure the appropriate library (oplXXX.dll/.so) is in your path.Exceptions:
    java java.lang.UnsatisfiedLinkError: no opl23 in java.library.path
    java java.lang.UnsatisfiedLinkError: no opl_lang_wrap_cpp in java.library.path
    java java.lang.UnsatisfiedLinkError: C:\ILOG\CPOptimizer23\bin\x86_win32\cp_wrap_cpp_java23.dll: Can't find dependent libraries
    java java.lang.UnsatisfiedLinkError: no concert_wrap_cpp_java23 in java.library.path
    java
    java Exception in thread "main" java.lang.ExceptionInInitializerError
    java at ilog.concert.cppimpl.IloEnv.<init>(IloEnv.java:49)
    java at ilog.concert.IloModelerAdvImpl.<init>(IloModelerAdvImpl.java:37)
    java at ilog.cp.IloCP.<init>(IloCP.java:111)
    java at ilog.cp.IloCP.<init>(IloCP.java:104)
    java at Color.main(Unknown Source)
    java Caused by: java.lang.RuntimeException: Native code library failed to load: ensure the appropriate library (oplXXX.dll/.so) is in your path.Exceptions:
    java java.lang.UnsatisfiedLinkError: no opl23 in java.library.path
    java java.lang.UnsatisfiedLinkError: no opl_lang_wrap_cpp in java.library.path
    java java.lang.UnsatisfiedLinkError: C:\ILOG\CPOptimizer23\bin\x86_win32\cp_wrap_cpp_java23.dll: Can't find dependent libraries
    java java.lang.UnsatisfiedLinkError: no concert_wrap_cpp_java23 in java.library.path
    java
    java at ilog.concert.IloJNILoader.loadJNI(IloJNILoader.java:102)
    java at ilog.concert.cppimpl.concert_wrapJNI.<clinit>(concert_wrapJNI.java:15)
    java ... 5 more
    java Java Result: 1

    I am trying to get my program running on 32bit Windows. I actually had no problem running it on 32bit and 64bit linux, just with Windows. One reason I suspect I am missing some dll's is that in 32bit linux libcp_wrap_cpp_java23.so is 30MB but in 32bit Windows cp_wrap_cpp_java23.dll is only 12.1MB. Do I need to have anything other than CP Optimizer 2.3 installed for this to work?

    Alex
    #CPOptimizer
    #DecisionOptimization


  • 4.  Re: Missing DLL in CP Optimizer 2.3 for Windows?

    Posted Wed February 10, 2010 10:28 AM

    Originally posted by: SystemAdmin


    Hello Alex.

    The difference in size of the DLLs between Linux and Windows is OK. I checked on 32bits Windows machine and it works in my case.

    Did you follow the instructions in cpoptimizer23/javadotnet.htm? In particular, at the end of the file there is the following note:

    Important Note:
    If you do not have Microsoft Visual Studio 2005/2008 installed on your machine, in order to run the Java examples, you may need to download the Visual C++ 2005 Redistributable Package or Visual C++ 2008 Redistributable Package from Microsoft (either the x86 or x64 version according to your platform).

    To download this package follow the link from the cpoptimizer23/javadotnet.htm.

    Let me know whether it helps. Petr
    #CPOptimizer
    #DecisionOptimization


  • 5.  Re: Missing DLL in CP Optimizer 2.3 for Windows?

    Posted Wed February 10, 2010 11:40 AM

    Originally posted by: SystemAdmin


    Petr,

    I followed the instructions in cpoptimizer23/javadotnet.htm and installed the Visual C++ 2008 Redistributable Package but this does not change the output I get when running ant on C:\ILog\CPOptimizer23\examples\x86_windows_vs2008\stat_mda\build.xml

    I looked around and the 32bit cp.lib file you link against for C++ and C# programs in C:\ILOG\CPOptimizer23\lib\x86_windows_vs2008\stat_mda is 36MB. I am still not convinced I have all the files needed, particularly since the error messages I am getting specifically name the files opl23.dll, opl_lang_wrap_cpp.dll, and concert_wrap_cpp_java23.dll.

    Is it possible to run/link my Java program against the cp.lib file directly?

    Kind regards,

    Alex
    #CPOptimizer
    #DecisionOptimization


  • 6.  Re: Missing DLL in CP Optimizer 2.3 for Windows?

    Posted Wed February 10, 2010 01:33 PM

    Originally posted by: Cedric Doens


    Hi Alex,

    Your C:\ILOG\CPOptimizer23\bin\x86_win32\cp_wrap_cpp_java23.dll uses a Cplex DLL delivered in the same repository.
    So could you try to add " C:\ILOG\CPOptimizer23\bin\x86_win32 " to your Path environment variable ?

    Otherwise try to use something like Dependency Walker (http://dependencywalker.com) in order to identify which dependent libraries can't be find.

    Cedric
    #CPOptimizer
    #DecisionOptimization


  • 7.  Re: Missing DLL in CP Optimizer 2.3 for Windows?

    Posted Wed February 10, 2010 02:41 PM

    Originally posted by: SystemAdmin


    Cedric,

    Thanks for the tip, I added "C:\ILOG\CPOptimizer23\bin\x86_win32" to my path and that fixed it. I checked with Dependency Walker and everything else looks fine.

    Alex
    #CPOptimizer
    #DecisionOptimization


  • 8.  Re: Missing DLL in CP Optimizer 2.3 for Windows?

    Posted Thu February 11, 2010 07:46 AM

    Originally posted by: Cedric Doens


    Good to feel helpful ;)
    You may encounter the same issue using C++ or .Net API.
    Check the readmeWindows.html for possible extra requirement.
    #CPOptimizer
    #DecisionOptimization


  • 9.  Re: Missing DLL in CP Optimizer 2.3 for Windows?

    Posted Tue March 02, 2010 11:34 AM

    Originally posted by: cboehle


    Hi,

    I'm getting the same error message but the solution doesn't work for me. The error message is:

    Native code library failed to load: ensure the appropriate library (oplXXX.dll/.so) is in your path.Exceptions:
    java.lang.UnsatisfiedLinkError: no opl10 in java.library.path
    java.lang.UnsatisfiedLinkError: no opl_lang_wrap_cpp in java.library.path
    java.lang.UnsatisfiedLinkError: no cp_wrap_cpp_java10 in java.library.path
    java.lang.UnsatisfiedLinkError: no concert_wrap_cpp_java10 in java.library.path

    I noted it's opl10 although I'm using version 6.3

    VM Arguments are: -Djava.library.path=C:\ILOG\OPL63\lib\;C:\ILOG\CPOptimizer23\bin\x86_win32\

    The example "oplrunsample" works, though.

    I used Depedency Walker which found that "msvcr80.dll" and "ieshims.dll" are missing. I then installed the Visual C++ 2008 Redistributable Package which doesn't help and files are still missing.

    Any more ideas?
    #CPOptimizer
    #DecisionOptimization


  • 10.  Re: Missing DLL in CP Optimizer 2.3 for Windows?

    Posted Thu March 18, 2010 10:49 AM

    Originally posted by: Didier Vidal


    Hi,

    If you run an OPL model from Java, I think you should add the OPL dlls in your path: C:\ILOG\OPL63\bin\x86_win32 - and maybe you don't need C:\ILOG\CPOptimizer23\bin\x86_win32\ .
    Does this work better with this ?

    Didier.
    #CPOptimizer
    #DecisionOptimization


  • 11.  Re: Missing DLL in CP Optimizer 2.3 for Windows?

    Posted Sun May 16, 2010 10:18 AM

    Originally posted by: SystemAdmin


    cboehle,

    I ran across the same problem as you today and have determined the culprit. Apparently the version that is appended to the library name when loading the shared libraries, e.g. the 10 in
    
    Native code library failed to load: ensure the appropriate library (oplXXX.dll/.so) is in your path.Exceptions: java.lang.UnsatisfiedLinkError: no opl10 in java.library.path java.lang.UnsatisfiedLinkError: no opl_lang_wrap_cpp in java.library.path java.lang.UnsatisfiedLinkError: no cp_wrap_cpp_java10 in java.library.path java.lang.UnsatisfiedLinkError: no concert_wrap_cpp_java10 in java.library.path
    


    is being pulled from MANIFEST.MF in the containing jar file. I found the following code in ilog.concert.IloJNILoader:
    
    
    
    private 
    
    static String getVersionInManifest() 
    { String version=IloJNILoader.class.getPackage().getSpecificationVersion(); 
    
    if (version==
    
    null) 
    { version=
    "6.3"; System.out.println(
    "No version in manifest (not in a jar?), trying "+version); 
    } 
    
    return(version.replaceAll(
    "\.",
    ""); 
    }
    


    What this means is that if you repackage the CP jar file (as I do to create an executable jar file for a client) then you will need to add the following to the MANIFEST.MF in the new jar file to specify the correct version of the shared libraries:
    
    Specification-Version: 2.3
    


    In addition, if you use both CP and CPLEX in the same Java project you'll need to have the CP jar file earlier in the classpath than the CPLEX jar file otherwise you will receive the error message above about missing opl10 library. The reason is the MANIFEST.MF in the CPLEX jar file reads:
    
    Specification-Version: 12.1.0
    

    and it appears that the library loader uses the last two characters of that version string.

    Hope this helps.

    Alex
    #CPOptimizer
    #DecisionOptimization


  • 12.  Re: Missing DLL in CP Optimizer 2.3 for Windows?

    Posted Wed April 14, 2010 03:38 AM

    Originally posted by: SystemAdmin


    Hey Alex B,
    HOW do you add "C:\ILOG\CPOptimizer23\bin\x86_win32" to your path? I was confused.

    Thanks for the tip, I added "C:\ILOG\CPOptimizer23\bin\x86_win32" to my path and that fixed it. I checked with Dependency Walker and everything else looks fine.

    Alex
    #CPOptimizer
    #DecisionOptimization


  • 13.  Re: Missing DLL in CP Optimizer 2.3 for Windows?

    Posted Fri April 16, 2010 07:37 AM

    Originally posted by: ChrisBr


    Hi,

    I'm not Alex B, but...

    My Computer > View system information > Advanced panel > Environment Variables > Path

    Chris
    #CPOptimizer
    #DecisionOptimization