java stack dump on windows

Solution 1:

You can use jstack [ option ] pid (if the question is about thread dump). Use jps to find the id of your Java process.

Solution 2:

Typing Ctrl+Break is the correct way to generate a thread dump on Windows.

Are you pressing Ctrl+C (=interrupt) maybe? That will send a SIGINT, which will generally kill your process.

Solution 3:

In the Java 6 JDK+ the jvisualvm executable allows you to attach to a running program (double click on its entry in the left side).

When attached, there is a Threads pane on the right side, which has a Thread Dump button.

This gives you a thread dump.

Once generated you can A) Select all - Copy and paste the thread dump to a text editor. or B) you can Right click on the thread dump created in the tree on the left hand side and say "Save as".

Notes jvisualvm also allows you to take snapshots of the whole application for later analyzis.

Solution 4:

This may help you but also depends on which JVM version and provider you are using.

http://java.sun.com/developer/technicalArticles/J2SE/monitoring/

http://java.sun.com/javase/6/docs/technotes/tools/share/jstack.html

http://java.sun.com/javase/6/docs/technotes/guides/visualvm/index.html