java - How does JPS tool get the name of the main class or jar it is executing -


I'm wondering, how does the GPS device get the name of the main square executed within the JVM process?

is jps -l 123 package. Main class 456 / path / explorer.jar

I'm talking specifically about Linux (I'm not interested in Windows), and I have no time to experiment Win machine is not.)

I can think of 2 ways

  1. Connecting to JVM in question which in turn says
  2. / proc from the file system

About the first option, whether it is using the local JMX connection Is it c? However, it should go to / proc for pids.

  1. PID, so it should also ask the OS
  2. jps < / Li> -or or main class
  3. / proc knows about PID well
  4. before jp start some things It has its own folder in / proc

but , I am facing less problem here. When the Java command is too long (as is the longest -classpath parameter), the information about the command line is not fit in / proc in the reserved space. This is 4kB for my system, and what I have learned elsewhere is hard work in the OS code (it requires kernel compilation to change). However, even in this case, jps is still able to get that main square somewhere else.

I need to find a fast way to get JVM process compared to calling jps . When the system is full (like when the number of JVM starts) jps got stuck for several seconds (I've waited it for ~ 30).

jps via scan / tmp / hsperfdata_ & lt ; Username & gt; / & Lt; Pid & gt; The files in which Monitor and JVM running counter are the string that you are looking for in the monitor named "Code> sun.rt.javaCommand .

To know the format of the PerfData file, you have to see.


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -