How do I get the id of my Java process?
I know there are several platform-dependent hacks, but I would prefer a more generic solution.
I am adding this, in addition to other solutions.
process id
final RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); final long pid = runtime.getPid(); out.println("Process ID is '" + pid);