Class ProcessUtils


  • public class ProcessUtils
    extends Object
    The Class ProcessUtils.
    • Field Detail

      • DEFAULT_WAIT_TIME

        public static int DEFAULT_WAIT_TIME
        The default wait time.
      • DEFAULT_LOOP_COUNT

        public static int DEFAULT_LOOP_COUNT
        The default loop count.
    • Constructor Detail

      • ProcessUtils

        public ProcessUtils()
    • Method Detail

      • createProcess

        public static ProcessBuilder createProcess​(String[] args)
                                            throws IOException
        Creates the process.
        Parameters:
        args - the args
        Returns:
        the process builder
        Throws:
        IOException - Signals that an I/O exception has occurred.
      • addEnvironmentVariables

        public static void addEnvironmentVariables​(ProcessBuilder processBuilder,
                                                   Map<String,​String> forAdding)
        Adds the environment variables.
        Parameters:
        processBuilder - the process builder
        forAdding - the for adding
      • removeEnvironmentVariables

        public static void removeEnvironmentVariables​(ProcessBuilder processBuilder,
                                                      List<String> forRemoving)
        Removes the environment variables.
        Parameters:
        processBuilder - the process builder
        forRemoving - the for removing
      • startProcess

        public static Process startProcess​(String[] args,
                                           ProcessBuilder processBuilder)
                                    throws IOException
        Start process.
        Parameters:
        args - the args
        processBuilder - the process builder
        Returns:
        the process
        Throws:
        IOException - Signals that an I/O exception has occurred.
      • translateCommandline

        public static String[] translateCommandline​(String toProcess)
        Translate commandline.
        Parameters:
        toProcess - the to process
        Returns:
        the string[]