new Exception("hello").printStackTrace(); Thread.getStackTrace()/Thread.getAllStackTraces() since jdk 1.5 Thread.currentThread().dumpStack()