As far as I understand, the java.library.path property is used by the JVM to load native libraries, just like the JNI library we load with System.loadLibrary(jniLib). However, it does not map to the traditional UNIX environment variables, and therefore does not influence any native code, like the library loader, that's trying to find the dependencies of jniLib.
Modifying the UNIX environment of the process from Java code is not possible (stackoverflow.com/questions/318239/how-do-i-set-environment-variables-from-java). You can read it using System.getenv(), but the map you get is read-only. A workaround might be to use a 2nd native library that modifies the environment using putenv(). But that's way too hackish for my taste, and we don't even know if the library loader will care about LD_LIBRARY_PATH or some other variable - after all, Google has optimized/stripped a lot of functionality we know from a desktop Linux.
Every Unix process that wants to use functionality of a shared library has to load it, either by using dlopen() or by embedding the information about required shared objects into the binary. In the latter case, the library loader will take care of loading the library and patching the addresses of the functions into the code. The OS doesn't really load the library into RAM multiple times if more than one process is using it, nevertheless every process has to load the shared library explicitly.
Modifying the UNIX environment of the process from Java code is not possible (stackoverflow.com/questions/318239/how-do-i-set-environment-variables-from-java). You can read it using System.getenv(), but the map you get is read-only. A workaround might be to use a 2nd native library that modifies the environment using putenv(). But that's way too hackish for my taste, and we don't even know if the library loader will care about LD_LIBRARY_PATH or some other variable - after all, Google has optimized/stripped a lot of functionality we know from a desktop Linux.
Every Unix process that wants to use functionality of a shared library has to load it, either by using dlopen() or by embedding the information about required shared objects into the binary. In the latter case, the library loader will take care of loading the library and patching the addresses of the functions into the code. The OS doesn't really load the library into RAM multiple times if more than one process is using it, nevertheless every process has to load the shared library explicitly.