RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Java
Expertise: Beginner
Mar 25, 1999

Display the Stack Trace

The stack trace is a useful debugging tool that you'll normally take advantage of when an exception has been thrown. It provides information on the execution history of the current thread, displaying the names of the classes and methods within those classes that had been called at the point when the exception occurred. However, there are times when it's helpful to display the stack trace even though an exception has not been thrown. The easiest way to do this is to use the static dumpStack() method in the Thread class:
This technique is useful, for example, when you have a method that is called from a variety of places within your code and you want to learn where it is being called from when a particular problem occurs.
Brett Spell
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date