How to know the CPU model like core i7-2600k in java? -
i know how system info can not find cpu model using system.getenv neither runtime.getruntime() nor systemenvironment.getsystemenvironment();
how can it?
you can in java using sigar api. download sigar here, add sigar.jar
, sigar-x86-winnt.dll
buildpath.
you can cpu details, example cpu model using code below:
import org.hyperic.sigar.sigar; import org.hyperic.sigar.sigarexception; public class cpuinfo { /** * @param args * @throws sigarexception */ public static void main(string[] args) throws sigarexception { // todo auto-generated method stub sigar sigar = new sigar(); org.hyperic.sigar.cpuinfo[] cpuinfolist = sigar.getcpuinfolist(); for(org.hyperic.sigar.cpuinfo info : cpuinfolist){ system.out.println("cpu model : "+info.getmodel()); } } }
Comments
Post a Comment