Here you can find the source of printStackTrace()
public static void printStackTrace()
//package com.java2s; //License from project: Open Source License public class Main { public static void printStackTrace() { StackTraceElement[] trace = Thread.currentThread().getStackTrace(); for (int i = trace.length - 1; i >= 0; i--) System.out.println("trace[" + i + "] " + trace[i].getClassName() + "." + trace[i].getMethodName()); }//from w w w . jav a2 s .com }