public class PIDUtil extends Object
| Constructor and Description |
|---|
PIDUtil() |
| Modifier and Type | Method and Description |
|---|---|
static int |
getLinuxPIDWithBash()
Return the PID of the Java VM under Linux using bash.
|
static int |
getPID()
Tries each of the methods in this class and returns the PID as reported
by the first method that succeeds.
|
static int |
getPIDWithRuntimeMXBean()
Return the JVM PID.
|
static void |
main(String[] args)
Utility for checking which method works on your platform.
|
public static int getLinuxPIDWithBash()
RuntimeException - if anything goes wrong.public static int getPIDWithRuntimeMXBean()
UnsupportedOperationException - if the pid can not be extracted.RuntimeMXBean#getName(), A web search will show that this is
generally of the form "pid@host". However this is definitely NOT
guaranteed by the javadoc.public static int getPID()
public static void main(String[] args) throws InterruptedException
args - InterruptedExceptionCopyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.