Java: Read System Information

Source: Internet
Author: User

Com.sun.management.OperatingSystemMXBean Mxbean =      (Com.sun.management.OperatingSystemMXBean)      Managementfactory.getoperatingsystemmxbean ();         SYSTEM.OUT.PRINTLN ("Operating system:" +mxbean.getname ());     System.out.println ("Number of CPUs:" + mxbean.getavailableprocessors ());     SYSTEM.OUT.PRINTLN ("Virtual Memory:" +mxbean.getcommittedvirtualmemorysize ()/1024 + "KB");     SYSTEM.OUT.PRINTLN ("Available Physical Memory:" +mxbean.getfreephysicalmemorysize ()/1024x768 + "KB");     System.out.println ("Free Swap Space Size:" +mxbean.getfreeswapspacesize ()/1024x768 + "KB");     System.out.println ("Process CPU Time:" +mxbean.getprocesscputime ());     SYSTEM.OUT.PRINTLN ("Total Physical memory Size:" +mxbean.gettotalphysicalmemorysize ()/1024x768 + "KB");     System.out.println ("Total Swap Space Size:" +mxbean.gettotalswapspacesize ()/1024x768 + "KB");

  

    • Operatingsystemmxbean

      This class provides simple information about the operating system, such as the schema name, current number of CPUs, recent system load, and so on.

    • Runtimemxbean

      Run-time information includes the name of the current virtual machine, provider, version number, and Classpath, Bootclasspath, and system parameters, among others.

2008-04-29

Java: Read System Information

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.