Hi there,
Question is about the following line:
proc.waitFor();    //try removing this line

When I keep running this program with or without this line - I cannot
see any differance. The notepad appears ok, and i can close it with no
problems too.

Could someone please explain, what is happening when i remove the
line ?
I dont really understand the explanation found in the APIs, which is:

 waitFor()  - causes the current thread to wait, if necessary, until
the process represented by this Process object has terminated.
Thank you.

<code>

try {

            if (System.getProperty("os.name").startsWith("Windows")){
                // Run a OS specific program
                proc = rt.exec("notepad");
            }
            else{
                proc = rt.exec("gedit");
            }

            proc.waitFor();    //try removing this line
        } catch (Exception e) {
            System.out.println("notepad is an unknown command.");
        }
    }

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to