声明:这段代码也是从网上摘抄的,当时忘记记录地址了,此为转载,勿怪
public static String handleException(Exception e) { StringBuffer message = new StringBuffer(); StackTraceElement [] exceptionStack=e.getStackTrace(); message.append(e.toString()); // java.lang.NumberFormatException: For input string: "s" for(StackTraceElement ste : exceptionStack) { message.append("\n\t at " + ste); // at ***.***.**(**) } return message.toString(); }