(原创)JAVA 读取硬件信息(MAC 地址,CPU 号,硬盘卷标,CPU 型号及CPU 使用率等信息) (2011-03-27 00:16:12) 转载 标签: java 读mac 地址 cpu 号 硬盘卷标 cpu 型号 cpu 使用率等 杂谈 分类: java 开发 在发布新版的MYPM 时,加密要用到相关硬件信息,于是写了下面的测试类 运行 main 打印信息如下图 需要引用的包 sigar-1
jar 及相关动态库 测试时我加载了sigar 自带所有动态库 详见 main 方法内 package cn
common
util; import java
BufferedReader; import java
File; import java
FileWriter; import java
InputStreamReader; import org
hyperic
CpuPerc; import org
hyperic
Sigar; import org
hyperic
SigarException; import org
hyperic
SigarLoader; import org
hyperic
Shell; import org
hyperic
SigarCommandBase; public class CpuInfo extends SigarCommandBase { public boolean displayTimes = true; public CpuInfo(Shell shell) { super(shell); } public CpuInfo() { super(); } public String