Java examples for java.lang:Exception
find Stack Trace from Throwable
//package com.java2s; import java.io.PrintWriter; import java.io.StringWriter; public class Main { /**/*from w ww . j ava2 s . co m*/ * @param t Throwable * @return String */ public static String findStackTrace(Throwable t) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); t.printStackTrace(pw); return sw.toString(); } }