這是個整合的工具類 @Component public class xxx{ public interface Clibrary extends Library { String testDllUtil (String xxx);//so文件中的接口 Clibrary INSTANCE = (Clibrary) Native.loadLibrary("/usr/src/debug/apache-tomcat-8.5.45/webapps/ROOT/WEB-INF/classes/testDllUtil /xxxx.so", Clibrary.class); } public static String DllUtil(xxx xxx) { String xxx= String.format("%s|%s|%s|", xx,xx,xx);//string.format是用於拼接字符串的 此處用 | 拼接 return Clibrary.INSTANCE.xxx(xxx); } }
參考連接爲 https://www.cnblogs.com/xiangjinpeng/p/10275660.htmlhtml
jar包的GitHub連接:https://github.com/java-native-access/jnajava