Posted By

cruelfate on 03/02/11



Versions (?)

PID of Java Process From Same Process Without Using Exec

 / Published in: Java

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.

  1. String pid = ManagementFactory.getRuntimeMXBean().getName();
  2."Foo started: pid = " + pid);

Report this snippet  

You need to login to post a comment.