Home / Java Patterns and Pitfalls     frequal.com

Helpful Stack Trace for Java Debugging

For quick, free, and easy stack inspection for your running Java program, put this code at the point you want to inspect the stack:
new Exception("Your message here").printStackTrace();
When this code is reached, the stack trace will be printed to standard output, along with your message. If you have a lot of output simply save it in a file and search for your string.

If you have a method which is called from several different locations and you need to know which caller is responsible, this can help.

Also, read this article about an online stack trace dump tool that works on any internet-connected computer.


Last modified on 18 Oct 2008 by AO

Copyright © 2024 Andrew Oliver