 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Daniele Simonelli Guest
|
Posted: Sun Jun 20, 2004 8:30 am Post subject: [newbie] Help with Runtime.exec |
|
|
I'm trying to launch a DOS application from a Java program in a Windows ME
environment, using for this purpose the method Runtime.exec(String command,
String[] envp,Java.io.File dir).
I put this instruction in a separated thread and built two
BufferedStreamReader objects to read data from the DOS command's output and
error stream. I access these steams by the Process.getInputStream() and
Process.getOutputStream() methods of the Process object returned by
Runtime.exec.
I meant to read these stream continuosly until the DOS command came to an
end.
Unfortunately, the thread which contains the Runtime.exec call locks at that
method call, and it SEEMS to happen if the content of one of these two
streams exceeds the length of some hundreds of bytes.
If I terminate that DOS process from Windows, the thread unblocks normally,
but the content of the streams exceeding the "critic" length is lost.
Can anyone help me?
I will post the code if you are interested.
Thanks in advance,
Daniele Simonelli
|
|
| Back to top |
|
 |
Roedy Green Guest
|
Posted: Sun Jun 20, 2004 11:56 am Post subject: Re: [newbie] Help with Runtime.exec |
|
|
On Sun, 20 Jun 2004 10:30:47 +0200, "Daniele Simonelli"
<danielesimo (AT) tiscalinet (DOT) it> wrote or quoted :
| Quote: | I put this instruction in a separated thread and built two
BufferedStreamReader objects to read data from the DOS command's output and
error stream.
|
You need a read thread and a write thread.
See http://mindprod.com/jgloss/exec.html
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
|
|
| Back to top |
|
 |
Daniele Simonelli Guest
|
Posted: Tue Jun 22, 2004 8:16 am Post subject: Re: [newbie] Help with Runtime.exec |
|
|
It worked very fine, thank you!
--
Daniele Simonelli
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|