How to determine main class at runtime in threaded java application?

后端 未结 10 1024
野的像风
野的像风 2021-01-01 13:37

I want to determine the class name where my application started, the one with the main() method, at runtime, but I\'m in another thread and my stacktrace doesn\'t go all the

10条回答
  •  南笙
    南笙 (楼主)
    2021-01-01 14:22

    Try using Thread.getAllStackTraces(). It returns a Map of the stack traces from all running threads, not just the current one.

提交回复
热议问题