AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[newbie] Help with Runtime.exec

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
Daniele Simonelli
Guest





PostPosted: Sun Jun 20, 2004 8:30 am    Post subject: [newbie] Help with Runtime.exec Reply with quote



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





PostPosted: Sun Jun 20, 2004 11:56 am    Post subject: Re: [newbie] Help with Runtime.exec Reply with quote



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





PostPosted: Tue Jun 22, 2004 8:16 am    Post subject: Re: [newbie] Help with Runtime.exec Reply with quote



It worked very fine, thank you!


--
Daniele Simonelli


Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.