As everyone might know, you have to set the java.library.path system property for making sure that you can load some JNI libraries in your java application. But often it wont be enough for you to specify java.library.path. The libraries which are referencing other shared libraries, would depend on standard way to resolve the libraries. Which means that if you have a foo.so which you are trying to load in your Java application, and foo.so references or is dynamically linked to bar.so, foo.so will look for the bar.so using the LD_LIBRARY_PATH.
java.library.path only works to resolve the immidiate native library that you are loading in your code. Loading of the other dependent libraries is left to the first library. The JNI library that you load will rely on the OS dependent way to resolve its references.
The catch is that, you will have to provide both java.library.path and LD_LIBRARY_PATH in such case for the libraries to load successfully. So its reliable to depend on the OS dependent way (LD_LIBRARY_PATH) of loading library files than java.library.path system property.
How to get the byte array Class instance?
Have you ever wondered how you can get handle to the Class instance for bye array (byte [])? Its easier to get handle to instances of other primitives like Integer by just doing Integer.class. I don't know if there is any better and standardized way to do it, but I just did (new byte [0]).class.
Any one knows a better way?
Any one knows a better way?