I try to get the memory usage of a process started via Java.
Can someone give me a hint how to do it for the example Notepad.exe?
// Memoryusage of the Java programm
Runtime runtime=Runtime.getRuntime();
total = runtime.totalMemory();
System.out.println("System Memory: " + total);
ProcessBuilder builder = new ProcessBuilder("notepad.exe");
Process p = builder.start();
Thanks for your help!
this post has your answer Java ProcessBuilder memory
quoting top answer:
This question here including
solved my problem.
You could run a system command and dump it's output in a file. Then, parse this file to find the memory usage.