try { ... } // printing a stack trace on an exception catch ( Exception e ) { e.printStackTrace(); // or e.printStackTrace( System.err ); }