Java tutorial
//package com.java2s; //License from project: Apache License public class Main { /** * Get the currentThread StackTrace * <p>VMStack.getThreadStackTrace<p/> * * @return */ public static StackTraceElement getCallerStackTraceElement() { return Thread.currentThread().getStackTrace()[4]; } }