stdin & stdout of child process

Discussion in 'Java' started by Guest, Aug 29, 2005.

  1. Guest

    Guest Guest

    I want from my java app to run this shell command (as child process):

    php -n my_script.php

    I want to create the stdin of child process from a string in my app
    (e.g. String stdin_in_child).

    I want to retrieve the stdout of child process (when it finished) in a
    string in my app (e.g. String stdout_from_child).


    I see the ProcessBuilder and Process but I failed to create a working
    piece of code.

    Can you help me with a URL or a simple piece of code?


    Special thanks
     
    Guest, Aug 29, 2005
    #1
    1. Advertising

  2. Guest

    Roedy Green Guest

    On Mon, 29 Aug 2005 22:57:22 +0300, "<- Chameleon ->"
    <> wrote or quoted :

    >I see the ProcessBuilder and Process but I failed to create a working
    >piece of code.
    >
    >Can you help me with a URL or a simple piece of code?


    See http://mindprod.com/jgloss/exec.html
    There is an example. I have not done an example with four threads.
    For help on that see http://mindprod.com/jgloss/thread.html

    If you can do lock step read/write with the child, you can get away
    with one thread.

    Just read and write the streams in the standard ways that
    http://mindprod.com/applets/fileio.html
    will show you.

    --
    Canadian Mind Products, Roedy Green.
    http://mindprod.com Again taking new Java programming contracts.
     
    Roedy Green, Aug 29, 2005
    #2
    1. Advertising

  3. <- Chameleon -> wrote:
    > I want from my java app to run this shell command (as child process):
    >
    > php -n my_script.php
    >
    > I want to create the stdin of child process from a string in my app
    > (e.g. String stdin_in_child).
    >
    > I want to retrieve the stdout of child process (when it finished) in a
    > string in my app (e.g. String stdout_from_child).
    >
    >
    > I see the ProcessBuilder and Process but I failed to create a working
    > piece of code.
    >
    > Can you help me with a URL or a simple piece of code?
    >


    Why don't you post what you and in what ways it fails to measure up?

    Ray

    --
    XML is the programmer's duct tape.
     
    Raymond DeCampo, Aug 30, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike Finister
    Replies:
    1
    Views:
    748
  2. Mike Finister
    Replies:
    3
    Views:
    477
    Shug Boabie
    Jul 24, 2004
  3. xman
    Replies:
    4
    Views:
    780
    Michael DOUBEZ
    May 14, 2007
  4. Ben
    Replies:
    2
    Views:
    1,398
    jacob navia
    Aug 29, 2009
  5. Z W
    Replies:
    0
    Views:
    194
Loading...

Share This Page