Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
3 replies Latest Post - ‏2014-03-25T12:48:07Z by alberto.pereto
SystemAdmin
SystemAdmin
554 Posts
ACCEPTED ANSWER

Pinned topic Native code library failed to load Error in using OPL/Cplex in java

‏2013-02-13T05:06:05Z |
Dear All

I installed CPLEX Studio 12.5 and have written an OPL model and data (.mod and .dat) files that I need to load & run as part of a JAVA program.
I use eclipse IDE for this, and have used <OPL_DIR>\lib\oplall.jar to resolve the references for the APIs used.
I add the <OPL_DIR>\bin\x86_win32\ as the "native library location" for the jar file in build path libraries settings

When I run the same I get following exception:

Native code library failed to load: ensure the appropriate library (opl125.dll/.so) is in your path.
Exceptions:
C:\Documents and Settings\anubha\My Documents\CPLEX_Studio\opl\bin\x86_win32\opl125.dll: Can't find dependent libraries
no opl_lang_wrap_cpp in java.library.path
no opl_core_wrap_cpp_java125 in java.library.path
no opl_core_wrap_cpp in java.library.path
no cp_wrap_cpp_java125 in java.library.path
no cp_wrap_cpp in java.library.path
no concert_wrap_cpp_java125 in java.library.path
no concert_wrap_cpp in java.library.path
It might also be related to missing vsrdist runtime DLLs.
Exception in thread "main" java.lang.ExceptionInInitializerError
  • at ilog.concert.cppimpl.concert_wrap.setDebugWrappers(concert_wrap.java:34)*
  • at ilog.opl.IloOplFactory.setDebugMode(IloOplFactory.java:152)*
  • at OplTrial.main(OplTrial.java:15)*
Caused by: java.lang.RuntimeException: Native code library failed to load: ensure the appropriate library (opl125.dll/.so) is in your path.
Exceptions:
C:\Documents and Settings\anubha\My Documents\CPLEX_Studio\opl\bin\x86_win32\opl125.dll: Can't find dependent libraries
no opl_lang_wrap_cpp in java.library.path
no opl_core_wrap_cpp_java125 in java.library.path
no opl_core_wrap_cpp in java.library.path
no cp_wrap_cpp_java125 in java.library.path
no cp_wrap_cpp in java.library.path
no concert_wrap_cpp_java125 in java.library.path
no concert_wrap_cpp in java.library.path
It might also be related to missing vsrdist runtime DLLs.
  • at ilog.concert.IloJNILoader.loadJNI(IloJNILoader.java:85)*
  • at ilog.concert.cppimpl.concert_wrapJNI.<clinit>(concert_wrapJNI.java:15)*
  • ... 3 more*
Any help to resolve this is appreciated! Thanks in advance.
Updated on 2013-02-14T10:48:01Z at 2013-02-14T10:48:01Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    554 Posts
    ACCEPTED ANSWER

    Re: Native code library failed to load Error in using OPL/Cplex in java

    ‏2013-02-13T08:48:35Z  in response to SystemAdmin
    Adding system load statements below as also suggested by the thread @
    http://www.ibm.com/developerworks/forums/thread.jspa?threadID=427546
    removes the error but is not quite the desired solution.

    System.load("C:/Documents and Settings/anubha/My Documents/CPLEX_Studio/opl/bin/x86_win32/ilog.dll");
    System.load("C:/Documents and Settings/anubha/My Documents/CPLEX_Studio/opl/bin/x86_win32/icudt48.dll");
    System.load("C:/Documents and Settings/anubha/My Documents/CPLEX_Studio/opl/bin/x86_win32/icuuc48.dll");
    System.load("C:/Documents and Settings/anubha/My Documents/CPLEX_Studio/opl/bin/x86_win32/icuin48.dll");
    System.load("C:/Documents and Settings/anubha/My Documents/CPLEX_Studio/opl/bin/x86_win32/dbkernel.dll");
    System.load("C:/Documents and Settings/anubha/My Documents/CPLEX_Studio/opl/bin/x86_win32/dblnkdyn.dll");
    System.load("C:/Documents and Settings/anubha/My Documents/CPLEX_Studio/opl/bin/x86_win32/cplex125.dll");
    System.load("C:/Documents and Settings/anubha/My Documents/CPLEX_Studio/opl/bin/x86_win32/oplnl112.5.0.dll");
    System.load("C:/Documents and Settings/anubha/My Documents/CPLEX_Studio/opl/bin/x86_win32/opl125.dll");
  • SystemAdmin
    SystemAdmin
    554 Posts
    ACCEPTED ANSWER

    Re: Native code library failed to load Error in using OPL/Cplex in java

    ‏2013-02-14T10:48:01Z  in response to SystemAdmin
    Was trying many things, and something did work :)
    Setting the PATH variable inside eclipse to also include the opl/bin/x86_win32 folder resolves the issue!

    Cheers.
  • alberto.pereto
    alberto.pereto
    1 Post
    ACCEPTED ANSWER

    Re: Native code library failed to load Error in using OPL/Cplex in java

    ‏2014-03-25T12:48:07Z  in response to SystemAdmin

    We've had the same problem, during the debugging event. But the workaround suggested didn't works :-(

    We are using ODME developer v3.7

    After some tests, we realized that if we: (a) close the eclipse IDE (b) remove the folder "org.eclipse.debug.core" from workspace (in our case, this folder is placed at "C:\Users\[OUR_USER]\workspace\.metadata\.plugins\org.eclipse.debug.core" (c) open the eclipse again, the error do not appears.

    It is a workaround that worked to us. Unfortunately, after close/open ODME developer (eclipse IDE) this error message shows up again during the debugging and the workaround procedure must be executed again.

    Regards.