Take the 2-minute tour ×

I need to get a stack trace for a JVM process running on a client machine that uses windows.

The client has the JRE installed but not the JDK.

I want to use JStack but it is not installed and we can't install a JDK on the client's machine. I also tried using AdaptJ stack trace product from a Java Webstart Session but that didn't work because we remote in and get an error about not being the session that started the application at a specified PID.

Essentially I want a way to install JStack without installing the JDK.

share|improve this question
Just for reference, "kill -3 pid" will cause a Unix/Linux jre to dump the entire thread stack trace to stdout. Very, very, very handy. –  Paul Tomblin Mar 18 '09 at 19:06
add comment

3 Answers

up vote 4 down vote accepted

You probably want to use SendSignal, which was designed for exactly this purpose.

share|improve this answer
From looking at the SendSignal webpage, I would be careful if the app is being run as a service (or otherwise has -Xrs (reduce signal usage)) as an argument. If so, Java's ctrl+break handling is disabled and the application will terminate when it receives this signal. –  Joshua McKinnon Mar 18 '09 at 19:32
Actually, I use SendSignal.exe for this purpose to cause a stackdump of a JRE running as a service. It works for me. –  Eddie Mar 18 '09 at 20:07
Yes, if someone runs "java -Xrs ..." then perhaps they'll have a problem with SendSignal.exe. The solution is that you can't do both at the same time. Choose one. Either use -Xrs or use SendSignal.exe to cause a stackdump. Your choice. –  Eddie Mar 18 '09 at 20:09
I tried a test with SendSignal where my java process was running in a open console window and it worked, i saw an error in the console window. But when a jvm process is running in the background where can i get the print out of the stack trace. –  richs Mar 18 '09 at 20:33
The stack trace goes to wherever standard output of the process goes. Ideally, this goes to a log file somewhere. –  Eddie Mar 18 '09 at 20:34
add comment

The JDK and associated tools work fine whether "installed" or not, if you just zip up and extract it to a temporary directory, you should be able to run jstack. (No PATH or JAVA_HOME modifications necessary). Just make sure you use the same version that corresponds to the JRE your client has the application running with. At least in the case of JConsole, it seems to fuss if the versions are different. I'm not sure if jstack behaves the same way.

I'm not saying this is the ideal solution, just that it would work. I think jdigital and Eddie's suggestions are better first bets, and even though this shouldn't interfere with an existing java installation the same way running the installer would, the customer may disagree regardless.

share|improve this answer
add comment

Would you be able to use JConsole via remote access?

share|improve this answer
+1 jvisualvm is also handy –  Bob Cross Mar 18 '09 at 19:07
add comment

Your Answer


