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();
//you can also use the above statement to open the notepad
    ProcessBuilder pb=new ProcessBuilder("notepad", "file.txt");

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