i think to waitFor() gives wait but for very less time so couldn't see
waiting.I think if u write this line 3-4 times then it may show difference
to you.try this

On Tue, Jul 21, 2009 at 2:08 AM, Tomasz <[email protected]> wrote:

>
> 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.");
>        }
>    }
>
> >
>


-- 
Sunil Jangid
3rd Year , B.Tech.
Electronics Engineering Department
IT-BHU
UP, INDIA - 221005

--~--~---------~--~----~------------~-------~--~----~
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