有没有办法判断一个class是否已经加载到jvm中?

Is there any way to judge whether a class has been loaded into jvm?

有没有办法判断一个class是否已经加载到jvm中? 在我看来,我认为方法是 findClass ,对吗?

使用 -verbose:class 打开 class 加载程序日志记录并阅读日志。

好的,所以我没有这样做。但似乎可以通过 Instrumentation API.

中的 getAllLoadedClasses()

但是您仍然需要使用 agent 启动 JVM。

您可以使用 jdk 工具,例如 JConsole。