Loading a Linux .so File at Java Runtime
Libraries on Linux are often named in the pattern libXXX.so
, and I believe Java follows that convention. So System.loadLibrary("Sample")
may be looking for libSample.so
. You can verify this by making a quick test program to call System.mapLibraryName
and checking the output.
To resolve the issue, assuming this is in fact the problem you're having, you can either rename your library file or use System.load
(not System.loadLibrary
), which will load the library specified by the exact filename you pass it, without any transformations. The latter method is not portable across platforms, though.