I am new to java.
I want something like debug_print_backtrace in java.
I want to print current stack trace to stdout or to intellij idea log window for debug.
I used to use debug_print_backtrace in php to find some stack infos in runtime for debug.
I am new to java.
I want something like debug_print_backtrace in java.
I want to print current stack trace to stdout or to intellij idea log window for debug.
I used to use debug_print_backtrace in php to find some stack infos in runtime for debug.
You only need one line.
new Exception().printStackTrace(System.out);
Thanks to Get current stack trace in Java
print stack trace to stderr:
new Exception().printStackTrace();
new Exception().printStackTrace(System.out);Instead of printing in console, use this javax.swing.JOptionPane.showMessageDialog(null,new Exception().printStackTrace());