简体   繁体   English

默认情况下在哪里安装本地Java库?

[英]Where to install local Java libraries by default?

I'm integrating JNI bindings with a C++ library. 我正在将JNI绑定与C ++库集成在一起。

The library follows the usual conventions: the installation root is /usr/local by default and can be modified with the --prefix argument to ./configure ; 该库遵循通常的约定:默认情况下,安装根目录为/usr/local ,并且可以使用./configure--prefix参数进行修改; the .a or .so files go in ${prefix}/lib ; .a.so文件位于${prefix}/lib etc. 等等

The JNI binding produces two new libraries, libfoojni.so (the native part) and libfoo.jar (the Java part). JNI绑定产生两个新的库, libfoojni.so (本机部分)和libfoo.jar (Java部分)。

Under this scheme, what is conventional place to put these files (eg ${prefix}/java )? 在这种方案下,放置这些文件的常规位置是什么(例如${prefix}/java )?

Is it preferable to allow the user to supply a separate Java root directory (eg, /usr/share/java )? 允许用户提供一个单独的Java根目录(例如/usr/share/java )是否更可取?

Should libfoojni.so go in ${prefix}/lib or in some Java-specific sub-directory? 应该将libfoojni.so放入${prefix}/lib还是某些特定于Java的子目录中?

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. 过去在Linux上完成JNI时,我已将.so文件与应用程序捆绑在JNI库的特定目录中。 Then add this to the LD_LIBRARY_PATH environment variable for the JVM instance running the application. 然后将其添加到运行该应用程序的JVM实例的LD_LIBRARY_PATH环境变量中。

So I would say that there isn't really a convention on this (besides the Linux lib directories for system wide stuff). 因此,我要说的是,这实际上没有约定(除了Linux lib目录中包含系统范围的内容)。

Hope that helps. 希望能有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM