• Post Reply Bookmark Topic Watch Topic
  • New Topic

I/O Stream Communication

 
Prashant Sehgal
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have two applications. One is Java based, the other is not. Both these are installed on a UNIX box. The second application takes the data available in the Standard Input Stream (System.in). I have data in my Java Application that I need to send to the second application via System.in.

This means that I am actually trying to fill-in the System.in with some data, so that another application can just read it.

I was reading though PipedInput and PipedOutput Streams, but am not sure how to use 'em.

How do I do it?

Thanks,
Prashant.
[ September 17, 2004: Message edited by: Prashant Sehgal ]
 
J Kneeland
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have the right idea, but wrong way. Look at the system.exec() method. It returns a Process object on which you can get an input stream and and output stream to talk to it.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Much simpler.
Redirect your java-output (System.out.println) to the unix-programm:



Of course this technique works for windows as well, but from 1000 users only one will know
 
Prashant Sehgal
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys.

Well I am already using the Runtime.exec() calls.

UNIX piping is slower than writing to System.out. That's why I need an alternative to piping.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!