operating system - How do I get OS properties in java program? -


hi need details operating system physical memory , cpu usage , other details. cannot pay amount available apis. can use free apis or can write own api.

i need details in below image.

enter image description here

in above picture have following values

  1. total
  2. cached
  3. available
  4. free

like values need. have searched lot , got hint. got first value total physical memory value using below code.

public class mbeanserverdemo {     public mbeanserverdemo() {         super();     }      public static void main(string... a) throws exception {         mbeanserver mbeanserver = managementfactory.getplatformmbeanserver();         object attribute =             mbeanserver.getattribute(new objectname("java.lang", "type", "operatingsystem"), "totalphysicalmemorysize");         long l = long.parselong(attribute.tostring());         system.out.println("total memory: " + (l / (1024*1024)));     } } 

the below output above program

total memory: 3293 

please me . how achieve this.

edit: have searched lot on google solution , found lot of posts in stackoverflow.com. in these posts people discussed memory details. need details kernal(paged , non-paged) etc. please refer post...

my requirement

thanks lot.

can please @ below api:

sigar api - system information gatherer , reporter https://support.hyperic.com/display/sigar/home

some examples usage : http://www.programcreek.com/java-api-examples/index.php?api=org.hyperic.sigar.sigar


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -