Use this code inside your catch block. This will return a string.
}catch(Exception e){
StringWriter sWriter = new StringWriter();
e.printStackTrace(new PrintWriter(sWriter));
System.out.println(sWriter.getBuffer().toString()) ;
}
No comments:
Post a Comment