显示每个可用 JVM 的主类名称,如 VisualVM
VisualVM 做得非常好,每个完整的主类名称都显示在左侧边栏导航中。如何检索这些名称? Attach API 为所有正在运行的 JVM 提供显示名称,但是,某些显示名称似乎有点臃肿,例如 Eclipse:
C:\Program Files\Eclipse\plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar -os win32 -ws win32 -arch x86_64 -showsplash -launcher C:\Program Files\Eclipse\eclipse.exe -name Eclipse --launcher.library C:\Program Files\Eclipse\plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.1.R36x_v20100810\eclipse_1309.dll -startup C:\Program Files\Eclipse\plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar -exitdata 1084_58 -product org.eclipse.epp.package.jee.product -vm C:\Windows\system32\javaw.exe -vmargs -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx512m -XX:MaxPermSize=256m -jar C:\Program Files\Eclipse\plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
VisualVM 将其缩短为:org.eclipse.equinox.launcher.Main
他们会取回它吗?从当前的JVM中很容易获得所有线程的主类。
VisualVM does it really nice, each full main class name is displayed in the left side-bar navigation. How are these names retrieved? The Attach API offers all running JVMs with a display name, however, some display names seem a little bit bloated, for instance Eclipse:
C:\Program Files\Eclipse\plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar -os win32 -ws win32 -arch x86_64 -showsplash -launcher C:\Program Files\Eclipse\eclipse.exe -name Eclipse --launcher.library C:\Program Files\Eclipse\plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.1.R36x_v20100810\eclipse_1309.dll -startup C:\Program Files\Eclipse\plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar -exitdata 1084_58 -product org.eclipse.epp.package.jee.product -vm C:\Windows\system32\javaw.exe -vmargs -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx512m -XX:MaxPermSize=256m -jar C:\Program Files\Eclipse\plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
Where VisualVM shortens it with: org.eclipse.equinox.launcher.Main
How do they retrieve it? From the current JVM its easy to obtain all threads main classes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看 VisualVM 源代码后,它会执行以下操作:
After looking at the VisualVM source it does something like this:
打开命令提示符并输入: jps -lm
这将显示 PATH 中当前 JVM 运行的所有 java 进程,并包含以下信息:
open up the command prompt and type: jps -lm
this will show all the java processes running with current JVM in your PATH with the following information: