How can I view memory usage, thread dump for java programs, from command line?

stackoverflow picture stackoverflow · Dec 9, 2011 · Viewed 9.3k times · Source

Is there any known command line tool to ask the JVM to see memory usage and thread dumps of a java program. something like a headless jvisualvm?

Answer

Roger Lindsjö picture Roger Lindsjö · Dec 9, 2011

You can use jstat to get gc information, jstack to get stack traces and jmap to get memory statistics and memory dumps for off-line inspection.