File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Writing to the Process OutputStream" Watch "Writing to the Process OutputStream" New topic

Writing to the Process OutputStream

Basit Noor

Joined: Jun 25, 2010
Posts: 1

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

myexec.exe < > outputs.out

The console redirects the output the outputs.out file and at the same time reads the inputs line by line from the 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.



I agree. Here's the link:
subject: Writing to the Process OutputStream
It's not a secret anymore!