Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Force Thread Dump in Eclipse?

I'm launching a Weblogic application inside Eclipse via the BEA Weblogic Server v9.2 runtime environment. If this were running straight from the command-line, I'd do a ctrl-BREAK to force a thread dump. Is there a way to do it in Eclipse?

like image 535
Paul Croarkin Avatar asked Oct 28 '08 13:10

Paul Croarkin


People also ask

How do you trigger a thread dump in Java?

Ctrl + Break (Windows) In Windows operating systems, we can capture a thread dump using the CTRL and Break key combination. To take a thread dump, navigate to the console used to launch the Java application, and press the CTRL and Break keys together.

What is Jstack command?

The jstack command prints Java stack traces of Java threads for a specified Java process. For each Java frame, the full class name, method name, byte code index (BCI), and line number, when available, are printed.


2 Answers

Indeed (thanks VonC to point to the SO thread), Dustin, in a comment to his message, points to jstack.

I have run a little Java application (with GUI) in Eclipse, I can see the related javaw.exe in Windows' process manager and its PID, 7088 (it is even simpler in Unix, of course).

If I type at a command prompt jstack 7088, I have the wanted stack dump per thread.
Cool.

Would be better if we could do that directly from Eclipse, but that's already useful as is.

like image 127
PhiLho Avatar answered Sep 19 '22 22:09

PhiLho


You can do it when you are in debug mode: go to the debug view in the debug perspective, click on the process you have launched and click on pause, you will get a graphical stack of all your processes.

Note : this also works when using remote debugging, you do not need to launch weblogic from eclipse, you can launch it on its own, open the debugging ports and create a "remote java application debug configuration" for it.

like image 24
Denis R. Avatar answered Sep 18 '22 22:09

Denis R.