| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <html lang="en"> |
| <head> |
| <meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2007. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." > |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css"> |
| <title> |
| Catching Java Exceptions |
| </title> |
| </head> |
| <body> |
| <h1> |
| Catching Java Exceptions |
| </h1> |
| <p> |
| It is possible to suspend the execution of thread when an exception is thrown by specifying an |
| exception breakpoint. Execution can be suspended at locations where the exception is |
| uncaught, caught, or both. |
| </p> |
| <ol> |
| <li> |
| Choose <strong>Add Java Exception Breakpoint</strong> from the |
| <a href="../reference/views/breakpoints/ref-breakpoints_view.htm"><strong>Breakpoints View</strong></a> or the workbench <strong>Run</strong> menu. </li> |
| <li> |
| A dialog listing all of the available exceptions is presented (see the following figure).<br> |
| <br> |
| <img src="../tasks/images/task-add-exception-breakpoint.PNG" alt="Add Exception Breakpoint Dialog"><br> |
| <br> |
| </li> |
| <li> |
| Type the name of the exception you want to catch or select it from the list. </li> |
| <li> |
| At the bottom of the page, use the checkboxes to specify how you want execution to suspend at locations where the exception is thrown. |
| <ul> |
| <li> |
| Select <strong>Caught</strong> if you want execution to suspend at locations where the exception |
| is thrown and caught by a <code>catch</code> clause. </li> |
| <li> |
| Select <strong>Uncaught</strong> if you want execution to suspend at locations where the exception is uncaught. </li> |
| </ul> |
| </li> |
| </ol> |
| <p> |
| <strong>Note:</strong> Exception breakpoints can be enabled and disabled and have hit counts |
| just like regular breakpoints. |
| </p> |
| <p> |
| <img border="0" src="../images/ngrelc.png" alt="Related concepts" ><br> |
| <a href="../concepts/concept-jdt.htm">Java development tools (JDT)</a><br> |
| <a href="../concepts/cbrkpnts.htm">Breakpoints</a> |
| </p> |
| <p> |
| <img border="0" src="../images/ngrelt.png" alt="Related tasks" ></p> |
| <p><a href="../tasks/tasks-create-exception-filter-expression.htm">Creating Exception Breakpoint Filters</a> <br> |
| <a href="../tasks/task-suspending_threads.htm">Suspending threads</a><br> |
| <a href="../tasks/task-add_line_breakpoints.htm">Adding breakpoints</a><br> |
| <a href="../tasks/task-remove_line_breakpoints.htm">Removing breakpoints</a><br> |
| <a href="../tasks/task-enable_disable_breakpoints.htm">Enabling and disabling breakpoints</a><br> |
| <a href="../tasks/task-set_method_breakpoints.htm">Setting method breakpoints</a><br> |
| </p> |
| <p> |
| <img border="0" src="../images/ngrelr.png" alt="Related reference" ><br> |
| <a href="../reference/views/breakpoints/ref-breakpoints_view.htm">Breakpoints view</a> <br> |
| <a href="../reference/views/breakpoints/ref-addexception_viewaction.htm">Add Java exception breakpoint</a><br></p> |
| <p> </p> |
| </body> |
| </html> |
| |