Can’t find dependent libraries

If you’ve done any JNI work or have worked with a 3rd party library with .dlls on Windows then you may have run into the dreaded “Can’t find dependent libraries” error. This is the extra credit problem that goes one step beyond java.library.path.

The root of the problem is that even with java.library.path set correctly, Windows will not look in anything other than its PATH for dependent libraries. This posting covers much of the problem, cause and solution. (I should point out that this is a Java problem not an Eclipse problem.) You might need to use something such as Dependency Walker to trace the set of DLL dependencies.

In case you were wondering, the dependency order for BDBXML 2.2.13 is:

System.loadLibrary("msvcp71");
System.loadLibrary("msvcr71");
System.loadLibrary("libdb43");
System.loadLibrary("libdb_java43");
System.loadLibrary("xerces-c_2_7");
System.loadLibrary("Pathan_7.1");
System.loadLibrary("libxquery12");
System.loadLibrary("libdbxml22");
System.loadLibrary("libdbxml_java22");

And the dependency order for BDBXML 2.3.10 is:

System.loadLibrary("msvcp71");
System.loadLibrary("msvcr71");
System.loadLibrary("libdb45");
System.loadLibrary("libdb_java45");
System.loadLibrary("xerces-c_2_7");
System.loadLibrary("Pathan_7.1");
System.loadLibrary("xqilla10");
System.loadLibrary("libdbxml23");
System.loadLibrary("libdbxml_java23");
Advertisements

15 comments

  1. plz i need ur help
    i need to know where i could found the java library path
    c:\\java \jre\lib???????????
    or what
    plz help

  2. Hi,
    I am interested in solving this for BDBXML, but I’m using version 2.3, and not sure exactly how to change the dependencies for it…
    In my case, I’m trying to use Firefox’s Liveconnect (in a XUL extension) to connect to Java to connect to BDBXML.
    But when trying the following in Javascript LiveConnect:
    java.lang.System.loadLibrary(“msvcp71”);
    java.lang.System.loadLibrary(“msvcr71”);
    java.lang.System.loadLibrary(“libdb45”);
    java.lang.System.loadLibrary(“libdb_java45”);
    java.lang.System.loadLibrary(“xerces-c_2_7”);
    java.lang.System.loadLibrary(“Pathan_7.1”);
    java.lang.System.loadLibrary(“libxquery12”);
    java.lang.System.loadLibrary(“libdbxml23”);
    java.lang.System.loadLibrary(“libdbxml_java23”);
    I get java.lang.UnsatisfiedLinkError: no libdbxml_java23 in java.library.path
    In case this were just a dependency issue, would you be able to tell me what the order is?
    thanks very much,
    Brett

  3. I’ve updated the post for Oracle’s BDBXML 2.3.10.
    BTW: all of this post assumes that you have the java.library.path set correctly which is what “java.lang.UnsatisfiedLinkError” is typically telling you.

  4. I have a C++ DLL that I wrapped in JNI to access it from Java. I have used the dependency walker tool and have found 2 DLLs are missing: MSVCP80D.DLL and MSVCR80D.DLL).
    If I build the DLL from MS Visual Studio (2005) in either Debug or Release modes everything works fine and DepWalker shows the 2 DLLs inside my new DLL.
    However, we build our project with Maven and it uses the command line to build the C++ DLL. I have double checked all the compiler and linker options but every time I build (debug or release) from maven/command line, I get a DLL that is missing the 2 above MS DLLs.
    Does anyone know how to force those to be included in my DLL via a linker option or something else??????

  5. Thanks to rgrzywinski for this info.
    I searched through multiple forums until I ran into this simple and effective answer.
    The interplay between java.library.path and Path was not clear to me until I read this.
    Many thanks.

  6. Thanks for helping. I fixed my problem by using dependencywalker and found out which dependent dlls are causing problem. Thanks again


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s