Sigar和平台依赖的库一起打包
-
cd sigar-all-in-one
-
mvn install
-
添加依赖
<dependency>
<groupId>org.fusesource</groupId>
<artifactId>sigar</artifactId>
<version>1.6.4</version>
</dependency>
- 使用
public static void main(String[] args) {
Sigar sigar = GoSigar.sigar();
try {
System.out.println(sigar.getCpu());
} catch (SigarException e) {
e.printStackTrace();
}
}