Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

java.lang.Process related question

Status
Not open for further replies.

venky

Programmer
Jun 7, 1999
5
US
hi,<br><br>I have written a small java class (say InputReader ) that reads the input from the keyboard and ends when the user enters the 'Ctrl+Z'. <br><br>I have another class that starts a Process thru Runtime.getRuntime().exec() method and executes the above <br>program &quot;java InputReader&quot; . The problem is that once i start the Process and waitFor the process to end using the Process.waitFor() method it never returns. <br><br>This happens even when i get the OutputStream of the Process and write something to it and then close it.<br><br>thanks in advance <br><br>venky
 
I am not really sure exactlly what you are doing but in the java documentation the runtime class is only instatiated once by the main method.&nbsp;&nbsp;Perhaps if you extended the thread class and started, paused, and stoped this thread instead of using the runtime class.&nbsp;&nbsp;Also in the documentation for the runtime class the method call that is inherited from object is wait() not waitFor().&nbsp;&nbsp;In the try catch statment you are using does the catch come up with an error message ?<br><br>hope this helps<br>ackka<br><A HREF="mailto:tmoses@iname.com">tmoses@iname.com</A> <p>moses<br><a href=mailto:tmoses@iname.com>tmoses@iname.com</a><br><a href= </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top