INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

easy debugging

How do I find out what a certain error is caused by? by carpeliam
Posted: 5 Jul 00

If you're using a system that uses breakpoints, it can be rather easy to find out where errors are coming from. If you find out that a particular line is creating an error, put it in a try block like this:

try {
  // this line throws an exception
} catch (Exception e) {
  System.out.println();
}


Put a break point at the System.out.println() line. From there, you can determine the values of all relative variables, and get a better idea of where your bug is coming from.

If your SDK doesn't have breakpoints, don't fret too much. Do the same thing, except in your System.out.println(), print out the values of any variables that might be pertinent. you might want to also call e.printStackTrace() to receive the stack trace (this is printed out in any case when the exception is not caught). Happy debugging!

Liam Morley

Back to Java FAQ Index
Back to Java Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close