public static void dumpStackTrace() {

    StackTraceElement[] ste = Thread.currentThread().getStackTrace();
    // [0] is getStackTrace
    // [1] is dumpStackTrace
    if (ste.length < 3) {
      System.out.println("No stack trace information available");
    } else {
      StackTraceElement caller = ste[2];
      System.out.printf(
          "%s.%s (%s line %d)",
          caller.getClassName(),
          caller.getMethodName(),
          caller.getFileName(),
          caller.getLineNumber());
      for (int ii = 3; ii < ste.length; ii++) {
        System.out.printf(" [%s line %d]", ste[ii].getFileName(), ste[ii].getLineNumber());
      }
      System.out.printf("%n");
    }
  }
public static void dumpStackTrace() {

    StackTraceElement[] ste = Thread.currentThread().getStackTrace();
    
    
    if (ste.length < 3) {
      System.out.println("No stack trace information available");
    } else {
      StackTraceElement caller = ste[2];
      System.out.printf(
          "%s.%s (%s line %d)",
          caller.getClassName(),
          caller.getMethodName(),
          caller.getFileName(),
          caller.getLineNumber());
      for (int ii = 3; ii < ste.length; ii++) {
        System.out.printf(" [%s line %d]", ste[ii].getFileName(), ste[ii].getLineNumber());
      }
      System.out.printf("%n");
    }
  }
public static void dumpStackTrace ( ) { StackTraceElement [ ] ste = Thread . currentThread ( ) . getStackTrace ( ) ; // [0] is getStackTrace // [1] is dumpStackTrace if ( ste . length < 3 ) { System . out . println ( "No stack trace information available" ) ; } else { StackTraceElement caller = ste [ 2 ] ; System . out . printf ( "%s.%s (%s line %d)" , caller . getClassName ( ) , caller . getMethodName ( ) , caller . getFileName ( ) , caller . getLineNumber ( ) ) ; for ( int ii = 3 ; ii < ste . length ; ii ++ ) { System . out . printf ( " [%s line %d]" , ste [ ii ] . getFileName ( ) , ste [ ii ] . getLineNumber ( ) ) ; } System . out . printf ( "%n" ) ; } }
Print the current java call stack.
Print the current java call stack .