aspose file tools
The moose likes Java in General and the fly likes input and ouput problem with BufferedReader/Writer to external process Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "input and ouput problem with BufferedReader/Writer to external process" Watch "input and ouput problem with BufferedReader/Writer to external process" New topic
Author

input and ouput problem with BufferedReader/Writer to external process

Chris Dancy
Ranch Hand

Joined: Feb 14, 2006
Posts: 136
Here is the issue. java program starts and launches an external program. I get the inputstream and outputstream of that process to play with. I can pipe all the inputstream information to a textarea just fine however... its when i want to give input to the outputstream that the problem occurs. I believe I'm just thinking of this the wrong way and am coming here for help.
Also if anyone looking at this code can knows how I can differentiate from a process that needs input to one that does not that would be great as well.

here is the sample code and the following ruby script I used for the external program...



here is the simple ruby script i am using...



again any help is appreciated.

Thanks in advance,

Christopher Dancy
[ December 30, 2008: Message edited by: Martijn Verburg ]

("Anger is not an emotion, its a symptom of fear.")
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3268

Hi Chris,

Are you getting any errors? Or are you not seeing your writes executed?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Chris Dancy
Ranch Hand

Joined: Feb 14, 2006
Posts: 136
No errors at all... The code just sits and waits ... The BufferedWriter is blocking for some reason, because if i dont even include it the program simply spits out the lines of the processes output, however when i do include it the program just sits and waits. And it waits at the loop, when a line is trying to be read and will not even continue further into the loop. The point of why im trying to do this is to make a small ide for my senior project and i want to mimic a console/terminal in the bottom pane like most ide's do. I simply cant seem to get this working and i've tried everything at this point. Sorry for getting back to you so late.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19232

I think you should read When Runtime.exec() won't.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: input and ouput problem with BufferedReader/Writer to external process
 
Similar Threads
Process waits forever when using Stringbuffer with more than 2000 strings
Java operator
Execute exe file from the java code with some input data
using java to run a perl script
BufferdReader/Writer problem