This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes Stack Trace Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Stack Trace" Watch "Stack Trace" New topic
Author

Stack Trace

Natraj Gudla
Ranch Hand

Joined: Feb 09, 2003
Posts: 34
Hi,
Is it possible that i can get the stack trace printed though i do not explicitly handle any exceptions in my program.?
Anupreet Arora
Ranch Hand

Joined: Jun 17, 2003
Posts: 81
Just create an exception and use its printStackTrace method, to print the stack trace at the default output.
If you don't throw the Exception object, you don't need to catch or handle it.
For example, at the location where you want the stack trace, just add the following code:

Exception e = new Exception("MyException");
e.printStackTrace();

I hope this helps!!
Cheeran!
Anupreet
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Stack Trace
 
Similar Threads
Exception in thread "pool-1-thread-467"
JSP + Mysql connection
Error
Null pointer on JR's home page
Unable to execute insertion!