Java System.loadLibrary dependencies

A 3rd party jar I use is trying to load a native library using System.loadLibrary. I think what is happening is that one of the libraries being loaded has a dependency on another native library. Pointing -Djava.library.path does not work properly in this case. The instructions from the app's site is put the dlls in the jre/bin directory, but I think this is a really bad idea (especially when trying to deploy to client sites).

So, this question really is 2 parts.

  1. Does it make sense that if a native lib tries to load another native lib that -Djava.library.path does not work?

  2. Is there a good solution for working around this problem? I guess I could explicitly call System.loadLibrary on all of the dlls (I'm not even sure if this would work), but I would need to make sure to call them in the correct order otherwise I'll have the same problem.

EDIT: I think this makes sense that it is happening, and the best solution I've read so far is to use dependency walker to figure it out and then load them in reverse order...but I'm open to better suggestions...

thanks, Jeff

6
задан Jeff Storey 13 December 2010 в 18:37
поделиться