Is possible to retrieve java callstack,
to determine which programm is calling from.
Throwable e = new Throwable();
// In java 1.4+
// e.fillInStackTrace();
// StackTraceElement[] elements = e.getStackTrace();
// String callerClass=(elements.length > 1 ? elements[1].toString() : "(no caller)");
//
In java 1.3
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
String callerClass=sw.toString();
venerdì 4 giugno 2010
Iscriviti a:
Commenti sul post (Atom)
Nessun commento:
Posta un commento