There are several ways to make it possible for the Java runtime to find and load a native shared library (.so) at runtime. I will list them briefly here, followed by examples with more explanation below.
- Call System.load to load the .so from an explicitly specified absolute path.
- Copy the shared library to one of the paths already listed in java.library.path
- Modify the LD_LIBRARY_PATH environment variable to include the directory where the shared library is located.
- Specify the java.library.path on the command line by using the -D option.
转载链接:https://www.chilkatsoft.com/java-loadLibrary-Linux.asp