Here you can find the source of printStackTrace()
public static void printStackTrace()
//package com.java2s; //License from project: Apache License public class Main { public static void printStackTrace() { try {// w ww.ja va 2 s . com throw new Exception(); } catch (Exception e) { e.printStackTrace(); } } public static void printStackTrace(String msg) { try { throw new Exception(msg); } catch (Exception e) { e.printStackTrace(); } } }