Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using pipes

Status
Not open for further replies.

McBugzz

Programmer
Sep 17, 2002
90
0
0
JP
I start a new process via Runtime.getRuntime().exec(), and I need to send some data to it. The new process should receive some of the data that I send, and then create a yet another process, which has to start receiving the data instead of the first one.

I belive I should use the Pipe object here, but so far I haven't found a good sample or doc on using pipes.

Suggestions?

Thanx
 
If you get a Process object from your Runtime.exec() then you can call the getInputStream() and getOutputStream() methods in attach to the stdin and stdout handles of the process.

Code:
Process p = Runtime.getRuntime().exec(whatever);
...
InputStream is = p.getInputStream();
OutputStream is = p.getOutputStream();
...

Don't know what you mean by "Pipe object" ...

--------------------------------------------------
Free Database Connection Pooling Software
 
BTW, this forum is for J2EE, core API Java questions should be posted in forum269 in the future ...

--------------------------------------------------
Free Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top