Java-ProcessBuilder

ProcessBuilder

ProcessBuilder provides another way to start and manage processes. ProcessBuilder offers more control over the processes. To create a process using ProcessBuilder, simply create an instance of ProcessBuilder, specifying the name of the program and any needed arguments. To begin execution of the program, call start( ) on that instance. Here is an example that executes the Windows paint editor.

Program

0

Program Source

public class Javaapp {
  
    public static void main(String[] args) {
        
        try {
            ProcessBuilder pro = new ProcessBuilder("mspaint");
            pro.start();
        }catch(Exception e)
        {
            System.out.println("Error Execuing Program");
        }
    }
}

Leave a Comment