Useful tool: jrcmd (repost from old BEA blog)
By Staffan Larsen on Aug 05, 2008
In the most basic incarnation, jrcmd lists the currently running JVMs on the system:
The first number is the process id of the process followed by the name of the main class and any command line parameters.> jrcmd 2512 org.eclipse.core.launcher.Main 1952 org.apache.tools.ant.launch.Launcher
Given the process id we can send some commands to that particular process. For example, to print a thread stack dump:
This is the same output you get when pressing Ctrl-Break or Ctrl-\, but this way you can get the information from a command line or from a script.> jrcmd 1952 print_threads ===== FULL THREAD DUMP =============== Mon Jan 03 10:27:53 2005 "Main Thread" id=1 idx=0x2 tid=256 prio=6 alive, in native at org/eclipse/swt/internal/win32/OS.WaitMessage()Z(Native Method) at org/eclipse/swt/widgets/Display.sleep()Z(Display.java:3108) ...
To see the list of available commands you can type 'help':
Go ahead and explore them! I will return to discuss some of the more interesting and useful commands.> jrcmd 1952 help