Make sure you create a reference to the Runtime object, as non static methods like freeMemory() and totalMemory() cannot be executed via the class java.lang.Runtime() .
Runtime myappRuntime = Runtime.getRuntime();
System.out.println("Total Free Memory is: " + myappRuntime.freeMemory());
System.out.println("Total Runtime Memory is: " + myappRuntime.totalMemory());
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.