
Untitled
By: a guest on
Jul 18th, 2012 | syntax:
None | size: 0.66 KB | hits: 5 | expires: Never
Getting Computer Memory information in Java [closed]
ProcessBuilder processBuilder = new ProcessBuilder("systeminfo");
processBuilder.redirectErrorStream(true);
Process process = processBuilder.start();
String output = readOutput(process);
try {
if (process.waitFor() != 0) {
throw new IOException(
"command exited in error: " + process.exitValue()
+ "n" + output);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
// here parse output for what you want
Total Physical Memory: xxx MB
Available Physical Memory: xxx MB
Page File: Max Size: xxxx MB
Page File: Available: xxxx MB
Page File: In Use: xxx MB