Class Jps


  • public class Jps
    extends Object
    Run a native process with jps -- get the pid for a running JVM note: dropping in an implementation for jps is not hard.
    Author:
    bnevins
    • Method Detail

      • main

        public static void main​(String[] args)
      • getPid

        public static List<Integer> getPid​(String mainClassName)
        return the platform-specific process-id of a JVM
        Parameters:
        mainClassName - The main class - this is how we identify the right JVM. You can pass in a fully-qualified name or just the classname. E.g. com.sun.enterprise.glassfish.bootstrap.ASMain and ASMain work the same.
        Returns:
        the process id if possible otherwise 0
      • isPid

        public static final boolean isPid​(int apid)
        Is this pid owned by a process?
        Parameters:
        apid - the pid of interest
        Returns:
        whether there is a process running with that id