aspose file tools*
The moose likes Threads and Synchronization and the fly likes Writing to the Process OutputStream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Writing to the Process OutputStream" Watch "Writing to the Process OutputStream" New topic
Author

Writing to the Process OutputStream

Basit Noor
Greenhorn

Joined: Jun 25, 2010
Posts: 1
Hello,

I have an executable that runs in the following way if I use cmd.exe on windows or console on linux:

myexec.exe < inputs.in > outputs.out

The console redirects the output the outputs.out file and at the same time reads the inputs line by line from the inputs.in file. (I assume most of you know this)

I am trying to perform the same thing using Java now, I managed to read the input stream and error stream from the process that is returned by the runtime:



I can use a FileWriter to write the output to the file. So redirecting of output is done.

I am struggling to write to the OutputStream of this process the correct information in the correct sequence. Is there a way to know that the Process is waiting for user input so that I can use the OutputStream to write to the executables stdin??

I will appreciate your support.

Regards,

Basit


 
Don't get me started about those stupid light bulbs.
 
subject: Writing to the Process OutputStream