import java.util.Map; import java.util.Map.Entry; public class Main { public static void main(String[] args) { Map threads = Thread.getAllStackTraces(); for (Map.Entry thread : threads.entrySet()) { System.out.println(thread.getKey().getName() + " :"); for (StackTraceElement trace : thread.getValue()) { System.out.println(" " + trace.getClassName() + "." + trace.getMethodName() + "(" + trace.getFileName() + ":" + trace.getLineNumber() + ")"); } System.out.println(); } } }