Is there a platform-independent Java operator for loading my own library from a directory other than the Java source code? I would like to use something like this:
public class HelloWorld {
static {
System.loadLibrary("../some_project/HelloWorld");
}
public static native void print();
}
The problem is that System.loadLibrary () does not support directory separators in the pathname argument. In addition, System.load (), unfortunately, requires an absolute path name, which not only means that I cannot specify the relative directory as above (which I would like to do), but it also requires the argument to include, for example, the previous extension "lib" and ".so" in the name of the JNI library on a Linux system.
Is there a standard way to deal with this? If possible, I would like to avoid writing a bunch of platform-specific Java code to build the correct JNI library name.
source
share