Class ProcessIdUtils


  • public class ProcessIdUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      ProcessIdUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getProcessId()
      There exists no platform-independent way that can be guaranteed to work in all jvm implementations.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ProcessIdUtils

        public ProcessIdUtils()
    • Method Detail

      • getProcessId

        public static java.lang.String getProcessId()
        There exists no platform-independent way that can be guaranteed to work in all jvm implementations. ManagementFactory.getRuntimeMXBean().getName() looks like the best solution, and typically includes the PID. On linux+windows, it returns a value like "12345@hostname" (12345 being the process id).
        Returns:
        process id of running Java virtual machine