Java examples for java.lang:Exception StackTrace
stack Trace To String
//package com.java2s; public class Main { public static final String stackTraceToString(Throwable e) { StringBuilder sb = new StringBuilder(); for (StackTraceElement element : e.getStackTrace()) { sb.append(element.toString()); sb.append("\n"); }// w w w . j a v a2 s.c o m return sb.toString(); } }