简体   繁体   English

由jvm加载的类

[英]classes loaded by jvm

我有一个正在运行的jvm进程,我想要一个工具来获取由jvm加载的类,是否有一个?

You can use jmap -histo <PID> 您可以使用jmap -histo <PID>

It'll show histogram of loaded classes including classname, number of instances, size, etc 它将显示已加载类的直方图,包括类名,实例数,大小等

jinfo <pid>

will give you quite a bit information, including the classpath and the jars in the path. 将为您提供相当多的信息,包括路径中的类路径和jar。 see here 看到这里

The jinfo command may be limited by the permissions granted to the principal running the command. jinfo命令可能受授予运行该命令的主体的权限的限制。 The command will only list the JVMs for which the principle has access rights as determined by operating system specific access control mechanisms. 该命令仅列出原则具有访问权限的JVM,这些JVM由操作系统特定的访问控制机制确定。

Note also that jinfo is not available on windows or linux itanium. 另请注意,jinfo在Windows或Linux itanium上不可用。

You can use the following in the command line 您可以在命令行中使用以下内容

java -verbose:class ....

and the JVM will dump out what it's loading including all its locations 并且JVM将转储其加载的内容,包括其所有位置

try visual VM. 尝试可视VM。 It is free but is not distributed with JRE/JDK but you can download it from official oracle website. 它是免费的,但不与JRE / JDK一起发布,但您可以从官方oracle网站下载。 Also you can make a heap dump and than you can view it by standard tools from JDK. 您也可以进行堆转储,而不是通过JDK的标准工具查看它。

如果进程启用了JMX,那么可以使用jvisualvm (与JDK捆绑在一起)来检查这些属性。

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

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