Print current caller class

suggest change

The following prints the current caller class. Note that in this case, the StackWalker needs to be created with the option RETAIN_CLASS_REFERENCE, so that Class instances are retained in the StackFrame objects. Otherwise an exception would occur.

public class StackWalkerExample {

    public static void main(String[] args) {;


class FooHelper {
    protected static void foo() {;

class BarHelper {
    protected static void bar() {


class test.FooHelper

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents