JDK’s bin directory – Command line monitoring tools

jdb.exe
Command line java debugger.

jsadebugd.exe
Remote debugging server. Attaches to a local JVM and then acts as a debugging server so that remote debuggers can attach to it to debug the local JVM process.

jcmd.exe
Command line tool to send diagnostic requests to a running JVM. To list all running JVMs with their process id, jcmd.exe can be called without parameters:

    
C:> jcmd
6244 com.example.Sample1
12244 sun.tools.jcmd.JCmd
7908 com.example.Sample1

To get a list of all supported commands, send the help command to a JVM:

C:> jcmd 6244 help
6244:
The following commands are available:
VM.native_memory
VM.commercial_features
ManagementAgent.stop
...

jhat.exe
Standalone web server to analyze a Java heap dump using a web browser. A heap dump from a running JVM can be created with jmap.exe:

C:>jmap -dump:file=x.dmp 6244
Dumping heap to x.dmp ...
Heap dump file created

C:>jhat x.dmp
Reading from x.dmp...
Dump file created Thu Jul 31 10:01:58 CEST 2014
Snapshot read, resolving...
Resolving 163483 objects...
Chasing references, expect 32 dots................................
Eliminating duplicate references................................
Snapshot resolved.
Started HTTP server on port 7000
Server is ready.

Now open https://www.labcorner.de:7000 in a web browser to browse the heap dump.

jinfo.exe
Command line tool to dump system properties and command line flags of a running JVM:

    
C:> jinfo 6244
Attaching to process ID 6244, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.51-b03
Java System Properties:

java.runtime.name = Java(TM) SE Runtime Environment
java.vm.version = 24.51-b03
...

jmap.exe
Command line tool to create heap dumps or to dump all shared libraries which are mapped into the JVM:

C:>jmap 6244
Attaching to process ID 6244, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.51-b03
0x0000000010000000      404K    C:\Program Files\WIDCOMM\Bluetooth Software\btmmhook.dll
0x00000000637d0000      7972K   C:\Program Files\Java\jdk1.7.0_51\jre\bin\server\jvm.dll
...

jps.exe
Lists the instrumented JVMs which are currently running.

jstack.exe
Dumps a stack trace of a running JVM:

C:>jstack 6244
2014-07-31 10:05:43
Full thread dump Java HotSpot(TM) 64-Bit Server VM (24.51-b03 mixed mode):

"TimerQueue" daemon prio=6 tid=0x000000000c8c2000 nid=0x2c68 waiting on condition [0x000000000fadf000]
   java.lang.Thread.State: WAITING (parking)
...

jstat.exe
Shows performance statistics for the class loader, garbage collector or JIT comiler of a running JVM. For example, to get statistics for the JIT compiler of the JVM with process ID 6244, the following command can be used:

C:>jstat -compiler 6244
Compiled Failed Invalid   Time   FailedType FailedMethod
      75      0       0     0,59          0

jstatd.exe
Remote monitoring server for jstat. Attaches to a local JVM and then acts as a monitoring server so that jstat can attach to it remotely to monitor the local JVM process.