Spring Boot using System.loadLibrary ( "XXX") in the Linux environment, so the file is loaded

Scene, so the file is loaded in Spring Boot, in the course of this recording configuration and helped me links to documents


System.loadLibrary("hello"); // Load native library at runtime
hello.dll (Windows) or libhello.so
Note: window environment file named hello.dll or libhello.so

 

Step 1: The so files are stored in a directory

 

 

Step 2: Linux to run jar file configuration library lib address

nohup java -Dfile.encoding=utf-8 -Djava.library.path=/root/baller/lib -jar picture-server.jar >nohup.log 2>&1 &

 At this point you will be prompted to run error: can not open shared object file: No such file or directory

 

 

Step 3: If the non-lib directory to the shared library profile /etc/ld.so.conf

Reference Address:  https://blog.csdn.net/chen495810242/article/details/89314570

# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
# echo "/root/baller/lib" >> /etc/ld.so.conf
# Ldconfig to refresh role

 

Step 4: Perform jar start again, no errors success

 

Guess you like

Origin www.cnblogs.com/eason-d/p/12401371.html