简体   繁体   English

获取给定JVM实例中所有当前已加载类的列表

[英]Get a listing of all currently loaded classes in a given JVM instance

It'd be handy to know which classes are currently loaded by a given JVM instance. 知道给定的JVM实例当前正在加载哪些类会很方便。

Is there some way to get them through JVisualVM, for instance? 例如,是否可以通过JVisualVM获得它们?

Edit: I'm aware of the solution given @ Java - Get a list of all Classes loaded in the JVM , yet I'd like to know if there's a way to do that through JVisualVM or some other tool. 编辑:我知道给定的解决方案@ Java- 获取JVM中加载的所有类的列表 ,但是我想知道是否有办法通过JVisualVM或其他工具来做到这一点。 At the moment I'm working against a RCP application, and I'd prefer to not having to run the application through the java tool (I'm lazy, yes). 目前,我正在处理RCP应用程序,我希望不必通过java工具运行该应用程序(我很懒,是的)。

Did you try jconsole ? 您尝试过jconsole吗?

Jconsole should be able to display list of loaded classes, see jConsole Documentation . Jconsole应该能够显示已加载类的列表,请参见jConsole文档

See the Viewing Overview Information section, the screenshot shows number of loaded classes. 请参阅“ 查看概述信息”部分,该屏幕截图显示了已加载类的数量。 Plus, you can see a tab called Classes , this is where the class loading info is. 另外,您可以看到一个名为Classes的选项卡,这是类加载信息所在的位置。

You can do this with VisualVM: 您可以使用VisualVM执行此操作:

  1. $JAVA_HOME/bin/jvisialvm $ JAVA_HOME / bin / jvisialvm
  2. Select your jvm app -> Sampler -> Memory -> click "Heap Dump" 选择您的jvm应用->采样器->内存->单击“堆转储”
  3. Open created Heap dump -> click "Classes". 打开创建的堆转储->单击“类”。 Where is a search field at bottom. 底部的搜索字段在哪里。

Your are welcome. 不客气。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM