欣影管理平台装置通道表修改
parent
b0d47bb571
commit
185488d9da
@ -0,0 +1,8 @@
|
||||
package com.shxy.xymanager_service.interaction;
|
||||
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Native;
|
||||
|
||||
public class CmaDLL implements Library {
|
||||
CmaDLL INSTANCE = (CmaDLL) Native.loadLibrary("xympj.dll",CmaDLL.class);
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.shxy.xymanager_service.interaction;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
|
||||
public class LibLoader {
|
||||
public static void loadLib(String libName) {
|
||||
String resourcePath = "/" + libName;
|
||||
String folderName = System.getProperty("java.io.tmpdir") + "/lib/";
|
||||
File folder = new File(folderName);
|
||||
folder.mkdirs();
|
||||
File libFile = new File(folder, libName);
|
||||
if (libFile.exists()) {
|
||||
System.load(libFile.getAbsolutePath());
|
||||
} else {
|
||||
try {
|
||||
InputStream in = LibLoader.class.getResourceAsStream(resourcePath);
|
||||
FileUtils.copyInputStreamToFile(in, libFile);
|
||||
in.close();
|
||||
System.load(libFile.getAbsolutePath());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("Failed to load required lib", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue