Try {
....................
}
Catch (Exception E) {
/ / Define a stream
ByteArrayoutputstream ostr = new byteArrayoutputStream ();
// Store the error stack to the stream
E.PrintStackTrace (New PrintStream (OSTR));
//print....
Out.println (Ostr.toString ());
}