Java OperatingSystemMXBean class

Description

Java OperatingSystemMXBean class

import java.lang.management.ManagementFactory;
import java.lang.management.OperatingSystemMXBean;
import java.util.List;

public class Main {

   public static void main(String[] args) {

      // Using the getPlatformMXBeans method
      List<OperatingSystemMXBean> list = ManagementFactory.getPlatformMXBeans(OperatingSystemMXBean.class);
      System.out.println("size: " + list.size());
      for (OperatingSystemMXBean bean : list) {
         System.out.println("Operating System Name: " + bean.getName());
         System.out.println("Operating System Architecture: " + bean.getArch());
         System.out.println("Operating System Version: " + bean.getVersion());
      }/*w  w w  .  j a v  a 2s  .co m*/

   }

}



PreviousNext

Related