• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

I/O Stream Communication

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic