VMware Cloud Community
rtacconi
Contributor
Contributor

sigar getArch() returns null

Hi I am using sigar with Eclipse. I have copied junit.jar, log4j.jar, sigar.jar and sigar-x86-winnt.dll (I am on win32) in the project's path. When I execute this code:

import org.hyperic.sigar.*;

public class Test {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
SysInfo si = new SysInfo();
System.out.println(si.getArch());
Cpu cpu = new Cpu();
System.out.println(cpu.getIdle());
DiskUsage du = new DiskUsage();
System.out.println(du.getReads());
}

}

I do not get any error by I get zero or null from any function, this is the output of the program:

null
0
0

Any idea why I get null/zero values?
0 Kudos
1 Reply
dougm_hyperic
VMware Employee
VMware Employee

You need to use the Sigar class to populate these objects.
Sigar sigar = new Sigar();
sigar.getFoo(...)

There are examples in bindings/java/src/org/hyperic/sigar/cmd/
0 Kudos