Loading native libraries without installing client packages

Hello!
I am currently developing an application that uses FoundationDB Java bindings (downloaded from maven repository). As stated in the javadocs, it relies on the native libraries that are installed together with client binaries. The problem is that i wanted for my application to run in an environment where foundationdb client is not a requirement.

In order to solve this problem, I downloaded libfdb_c.dylib from FoundationDB Downloads page and set the system property “FDB_LIBRARY_PATH_FDB_C” with the absolute path of the library. I figured out the name of the system property by looking up the code from FDB.java and JNIUtil.java files of the Java API. But, i am still getting the error Library not loaded: libfdb_c.dylib after loading fdb_java binding.

Is there a way to load the native dependencies of the FoundationDB Java API without installing the client binaries?

On macOS, there isn’t a great way. If you place lifdb_c.dylib in /usr/local/lib, that will do it, but that amounts to doing the same thing as installing it.

On Linux, if you place the native library in a directory and name the file libfdb_c.so and add that directory to the LD_LIBRARY_PATH environment variable, then it will get picked up. But that won’t work on macOS, which is what I’m assuming you’re using (because of the dylib file).

Thank you for your answer! Yes, i develop the application on macOS, but, besides sharing my project with other teammates who do not have FoundationDB client binaries installed, i was more worried about deployment process. It will suffice, as long as i can specify the directory in an environment variable on Linux, where the deployment will take place.

Much appreciated!