I used the SystemEnvironment class in Java for getting system information.
In that I can get only RAM size, I can’t get the specific disk space like c: and D:
code is,
com.sun.management.OperatingSystemMXBean mxbean = (com.sun.management.OperatingSystemMXBean)ManagementFactory.getOperatingSystemMXBean();
System.out.println(“Total RAM:”+mxbean.getTotalSwapSpaceSize()/(1024*1024*1024)+””+”GB”);
Can i get this in information in a Java program?
From
java.io.FileAPI:long getTotalSpace(): Returns the size of the partition named by this abstract pathname.long getUsableSpace(): Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname.long getFreeSpace(): Returns the number of unallocated bytes in the partition named by this abstract path name.The following snippet shows an example on how to use it: