Wednesday, March 23, 2011

Where to install local Java libraries by default?

I'm integrating JNI bindings with a C++ library.

The library follows the usual conventions: the installation root is /usr/local by default and can be modified with the --prefix argument to ./configure; the .a or .so files go in ${prefix}/lib; etc.

The JNI binding produces two new libraries, libfoojni.so (the native part) and libfoo.jar (the Java part).

Under this scheme, what is conventional place to put these files (e.g. ${prefix}/java)?

Is it preferable to allow the user to supply a separate Java root directory (e.g., /usr/share/java)?

Should libfoojni.so go in ${prefix}/lib or in some Java-specific sub-directory?

From stackoverflow
  • When I've done JNI in the past on Linux, I've bundled the .so files with the application in a specific directory for JNI libraries. Then add this to the LD_LIBRARY_PATH environment variable for the JVM instance running the application.

    So I would say that there isn't really a convention on this (besides the Linux lib directories for system wide stuff).

    Hope that helps.

0 comments:

Post a Comment