List of running JVMs on the localhost

后端 未结 8 1381
慢半拍i
慢半拍i 2020-12-24 15:57

How to get in Java 6+ the list of running JVMs on the localhost and their specs (i.e. Java version, running threads, etc.)?

Does the Java API provide such features?

8条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-24 16:28

    This, I found out today, is basically what JPS does: simply list the folder /tmp/hsperfdata_foo/ where foo is the user running the JVM.

    For some unknown reason, sometimes the files there won't be deleted when a JVM is killed.

    Here are the links to the source code:

    PerfDataFile.java

    LocalVmManager

提交回复
热议问题