2

i have a command line based program that i want to write a gui based wrapper for. is there a way that i can redirect the stdout steam from that program to my gui and launch the other program with arguments?

thank you

2 Answers2

2

Yes. Invoke the program using Process and grab the input / output / error stream of the process.(see an example here: http://www.rgagnon.com/javadetails/java-0014.html)

I am having some problems with formatting, so here are some relevant links:

  1. How to create a process in Java
  2. Java Process with Input/Output Stream
Community
  • 1
  • 1
MByD
  • 135,866
  • 28
  • 264
  • 277
1

try Apache common-exec, it provides an api to invoke commands and capture the stderr, sdtout and provide an stdin.

Augusto
  • 28,839
  • 5
  • 58
  • 88