Navigation

How to Get Call Stack Information from Remote Java VM?

BY MARKUS SPRUNCK

This article describes how to get call stack information from a remote Java VM.

Sample Code

Within a Java application it is an easy task to access the current call stacks, but sometimes it is not possible to add code for call stack access in a application, e.g. standard software, enterprise environments. In these cases the JDK provides a simple interface (in tools.jar) to obtain call stack information from any running VM.

The only limitation is, that the Java program to be investigated runs with the same user as the calling program. Just include the tools.jar of your JDK into the buildpath. And run the following code (don't forget to input an existing process id):