Java tutorial
//package com.java2s; public class Main { /** * Gets the stack trace string. * * @param e the e * @return the stack trace string */ public static String getStackTraceString(Exception e) { String stackTrace = ""; for (StackTraceElement l : e.getStackTrace()) stackTrace += l.toString(); return stackTrace; } }