search paths where one native library depends on another

Posted by carneades on Stack Overflow See other posts from Stack Overflow or by carneades
Published on 2010-03-24T20:06:41Z Indexed on 2010/03/24 20:13 UTC
Read the original article Hit count: 282

Filed under:
|
|

I'm using JNA and Java but I think this question affects any native-to-nonnative bridge.

I have a Java application which relies on lib1.dylib, and lib1.dylib relies on lib2.dylib.

I want to put everything inside of my .app file on Mac. I can easily put lib1.dylib inside and set java.classpath (or NativeLibrary.addSearchPath()) to tell the JVM where to find lib1.dylib. The trouble is, I don't know how to communicate that lib1.dylib's dependencies are also in the location I provided. The result is that lib1 is loaded fine, but then lib2 can't be found since it's not in the operating system's library path.

Anyone know how I can overcome this problem? I imagine it must come up plenty in big projects with large numbers of shared libraries.

© Stack Overflow or respective owner

Related posts about java

Related posts about jna