• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Writing to the Process OutputStream

 
Basit Noor
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic