The Artima Developer Community
Sponsored Link

Java Answers Forum
stacktrace for unchecked exceptions

4 replies on 1 page. Most recent reply: Jul 28, 2005 12:25 AM by rakesh kumar shukla

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 4 replies on 1 page
rakesh kumar shukla

Posts: 6
Nickname: rakshukla
Registered: Jul, 2005

stacktrace for unchecked exceptions Posted: Jul 25, 2005 11:25 PM
Reply to this message Reply
Advertisement
Hi friends,As I am new to Java I want to know in case of unchecked execptions which I am not catching in my code and if it occurs which code and when prints the stacktrace on my console


Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: stacktrace for unchecked exceptions Posted: Jul 25, 2005 11:52 PM
Reply to this message Reply
Give us an example of what you mean.

For the time being you can trace your Runtime
Exceptions as follows:



try{
// some code that causes an Exception
... ... ...
}catch(Exception e){
e.printStackTrace();
}



It is usually more accurate to catch specific
Exceptions e.g: InterruptedException e, if you're
dealing with Threads or SQLException e, if you're
dealing with JDBC (Java Database Connectivity)
related code, you may uses the Java API to look
up the Exception class it has the subclasses listed.
Google Java API or Java Doc, it should lead you
to the API pages.

Hope this helps.

One,
Spike

rakesh kumar shukla

Posts: 6
Nickname: rakshukla
Registered: Jul, 2005

Re: stacktrace for unchecked exceptions Posted: Jul 26, 2005 12:36 AM
Reply to this message Reply
I got your point but what I want to know is if I am not catching any unchecked exception and during run it occurs who throws and catches this exception prints the stacktrace
TIA
RKS

Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: stacktrace for unchecked exceptions Posted: Jul 26, 2005 11:53 PM
Reply to this message Reply
I can't tell you for sure, but I would suggest it's the runtime environment itself or the thread wich is created to run your program.

rakesh kumar shukla

Posts: 6
Nickname: rakshukla
Registered: Jul, 2005

Re: stacktrace for unchecked exceptions Posted: Jul 28, 2005 12:25 AM
Reply to this message Reply
I mean , if I am writing try-catch block for unchecked exceptions in my code then in the class file there are byte codes for the alternate flow but what if I am not writing try-catch block , where is alternate flow for priting the stacktrace , better if you can give me some example of this scenario

Thanks friends
RKS

Flat View: This topic has 4 replies on 1 page
Topic: jdbc connectivity Previous Topic   Next Topic Topic: Where have I gone wrong?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use