Java Utilities

  • Post author:
  • Post category:Java

Here are some Java utilities (with common parameters) we use for troubleshooting Production issues.

Display a list of all Java processes.

>jps

Display a list of all Java processes with full command line information.

>jps -lmv

Print available jstat options.

>jstat -options

Display GC information for theĀ given process id.

>jstat -gc {pid}

Create a thread dump, displayed on the console, for the given process id.

>jstack {pid}

Display heap summary for the given process id.

>jmap -heap {pid}

Display heap histogram for the given process id.

>jmap -histo:live {pid}

Create a heap dump in hprof format.

>jmap -dump:live,format=b,file=dump.hprof {pid}

Display available commands that can be sent to the Java process with the given id.

>jcmd {pid} help

Force a garbage collection.

>jcmd {pid} GC.run

Display uptime information.

>jcmd {pid} VM.uptime

Display performance information.

>jcmd {pid} PerfCounter.print

These utilities are great for scripting and headless environments. If you wish to work with graphical interface, check out VisualVM. Here’s a list of all the JDK Tools and Utilities.