Hi,
I am attempting to load a library in Linux using a command like:
System.loadLibrary("libName"
It appears that in order for Java to find the library when I run the program, I have to somehow set a path where the library can be found. Setting LD_LIBRARY_PATH works, but I would like to avoid this. I have found that when I set java.library.path on the command line like this, it works:
java -Djava.library.path=/root/libraryDir test
But for some reason when I try to set the path inside the code it doesn't work. I continue to get "java.lang.UnsatisfiedLinkError". I have even printed out the path inside the error handling and it indeed has the path I added, but for some reason it still doesn't find the library. I am using the following commands:
String path = System.getProperty("java.library.path"
System.setProperty("java.library.path",path + ":/root/libraryDir:"
If anyone knows how to correctly set the java.library.path inside the code, I would appreciate it. Thanks.
I am attempting to load a library in Linux using a command like:
System.loadLibrary("libName"
It appears that in order for Java to find the library when I run the program, I have to somehow set a path where the library can be found. Setting LD_LIBRARY_PATH works, but I would like to avoid this. I have found that when I set java.library.path on the command line like this, it works:
java -Djava.library.path=/root/libraryDir test
But for some reason when I try to set the path inside the code it doesn't work. I continue to get "java.lang.UnsatisfiedLinkError". I have even printed out the path inside the error handling and it indeed has the path I added, but for some reason it still doesn't find the library. I am using the following commands:
String path = System.getProperty("java.library.path"
System.setProperty("java.library.path",path + ":/root/libraryDir:"
If anyone knows how to correctly set the java.library.path inside the code, I would appreciate it. Thanks.