title: How to use getSystemCpuLoad() in JMX
body: <p>Hi i cant able to use getProcessCpuTime() or getProcessCpuLoad() or getSystemCpuLoad() in my java program. I used like below. </p>
  
  <pre><code>ManagementFactory. getOperatingSystemMXBean().getProcessCpuTime();
  </code></pre>
  
  <p>also like this</p>
  
  <pre><code>( (OperatingSystemMXBean) getOperatingSystemMXBean() ).getProcessCpuTime()
  </code></pre>
  
  <p>But its showing error like method getProcessCpuTime() is not found. I included the following header files. Is that enough or i need to use any more.?</p>
  
  <pre><code>import java.lang.management.ManagementFactory;
  import java.lang.management.OperatingSystemMXBean;
  </code></pre>
  
  <p>Can anyone please suggest me how to use these methods. am using jdk1.6. And my code is below</p>
  
  <pre><code>import java.lang.management.ManagementFactory;
  import java.lang.management.OperatingSystemMXBean;
  import java.lang.reflect.Method;
  import java.lang.reflect.Modifier;
  
  public class printUsage {
  
  public static void main(String[] args) {
  OperatingSystemMXBean operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean();
  
  System.out.println("getCpuProcessTime()" + " = " + operatingSystemMXBean.getProcessCpuTime());
  System.out.println("getCpuProcessTime()" + " = " + operatingSystemMXBean.getSystemCpuLoad());
  System.out.println("getCpuProcessTime()" + " = " + operatingSystemMXBean.getProcessCpuLoad());
  }
  
  }
  </code></pre>