Search code examples
javalinuxmacosjava-native-interface

Where would one put a JNI module in Linux or OS X


The Java application has the JNI module to use.

Where should a user (or an installation script of this application) put the JNI module on Linux (Ubuntu) or on MacOS X so that this JNI module could be loaded without specifying the path to the module in code?


Solution

  • Put the compiled libraries (.so files on Linux or .dylib on MacOS) into a directory of your choice and include this directory in the library search path LD_LIBRARY_PATH used to start your JVM.