1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| //-------------------------------------------------------
//Loading Required Libraries
//-------------------------------------------------------
public static void loadDLL() throws IOException {
try {
InputStream in = Main.class.getResourceAsStream("sigar-amd64-winnt.dll");
File fileOut = new File("sigar-amd64-winnt.dll");
OutputStream out = FileUtils.openOutputStream(fileOut);
IOUtils.copy(in, out);
in.close();
out.close();
System.out.println("Required library successfully loaded!");
} catch (Exception e) {
System.out.println("Failed to load required library...");
}
//Loading Library
try {
System.loadLibrary("sigar-amd64-winnt.dll");
} catch (UnsatisfiedLinkError e) {
}
//-------------------------------------------------------
} |
Partager