how does jconsole/visualvm know local running java apps

rogerdpack :

When you startup jconsole or visualvm they present to you a list of "locally running java apps" that could be attached to and monitored.

How does it know which apps running locally exist?

kidney :

Quoting from the VisualVM documentation (it is described in the When Are Explicit JMX Connections Necessary? section and concerns local instances):

Java VisualVM discovers running applications using the jps tool (Solaris, Linux, or Mac OS X or Windows), which can only discover Java applications started by the same user as the one who starts the Java VisualVM tool.

Info about how jps discovers local VMs is, for example, in this SO answer. In short, it scans the /tmp/hsperfdata_<username> directory, where JVM instances generate info files.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=378515&siteId=1