This question is same as org.hyperic.sigar.SigarException: no sigar-amd64-winnt.dll in java.library.path
but after adding sigar-amd64-winnt.dll in the path I am getting below error
org.hyperic.sigar.SigarException: C:\Users\akshay.naik\Documents\shortcuts\sigar-amd64-winnt.dll: Can't find dependent libraries
at org.hyperic.sigar.Sigar.loadLibrary(Sigar.java:172)
at org.hyperic.sigar.Sigar.<clinit>(Sigar.java:100)
at monitor.Monitor.main(Monitor.java:8)
I am running windows 10 , JDK 1.8
You just need to add the folder which contains required dll library to the system property. I put them into resouces/lib folder, and here's my code:
String property = System.getProperty("java.library.path");
String path = this.getClass().getClassLoader().getResource(".").getPath();
path = path + "lib";
System.setProperty("java.library.path", path + ";" + property);
Execute the code above on starting up.
If you are not using spring boot as your framework, you can add the dll files to any folder, and add the folder path to this property. On Windows 10, pathes are seperated by ";".
Then run the program, it'll work!
I'm also running Windows 10, JDK 1.8.