Return to Snippet

Revision: 42233
at March 2, 2011 03:34 by cruelfate


Initial Code
String pid = ManagementFactory.getRuntimeMXBean().getName(); 
log.info("Foo started: pid = " + pid);

Initial URL

                                

Initial Description
This is especially useful to have appear in logs.  While it is totally up to the JVM implementation what to return for the name, most seem to return a numeric process identifier.

Initial Title
PID of Java Process From Same Process Without Using Exec

Initial Tags
java

Initial Language
Java