Class Process


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

      Constructors 
      Constructor Description
      Process()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.ProcessBuilder createProcess​(java.lang.String cmd, boolean inheritIO)
      Spawns a new process.
      static java.lang.ProcessHandle getProcess​(java.lang.String name)
      Gets a specific process from all current running processes.
      static java.util.stream.Stream<java.lang.ProcessHandle> getProcesses()
      Gets all current running processes.
      static void stopProcess​(java.lang.String name, boolean kill)
      Stops a specific process.
      • Methods inherited from class java.lang.Object

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

      • Process

        public Process()
    • Method Detail

      • createProcess

        public static java.lang.ProcessBuilder createProcess​(java.lang.String cmd,
                                                             boolean inheritIO)
        Spawns a new process.
        Parameters:
        cmd - The command line to use.
        inheritIO - Whether or not to inherit the input and output of the process.
        Returns:
        The ProcessBuilder of the newly spawned process.
      • getProcesses

        public static java.util.stream.Stream<java.lang.ProcessHandle> getProcesses()
        Gets all current running processes.
        Returns:
        All current running processes, as a stream.
      • getProcess

        public static java.lang.ProcessHandle getProcess​(java.lang.String name)
        Gets a specific process from all current running processes.
        Parameters:
        name - The name of the process to look for.
        Returns:
        The ProcessHandle of the specific process, if not null.
      • stopProcess

        public static void stopProcess​(java.lang.String name,
                                       boolean kill)
        Stops a specific process.
        Parameters:
        name - The name of the process to stop.
        kill - Whether or not to kill the process.