Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Writing to the Process OutputStream  RSS feed

Basit Noor
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.



  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!