Use of ProcessBuilder and Runtime class to create/open a process

Process builder – to open process or program

 class F{
public static void main(String[] args) throws Exception{
    /*Runtime rtn=Runtime.getRuntime();
    rtn.exec("notepad");
    */
//you can also use the above statement to open the notepad
    ProcessBuilder pb=new ProcessBuilder("notepad", "file.txt");
    pb.start();
}
}

The above code, when compiled after saving, will open notepad on windows operating system at the time of execution of the program.