🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #15084

How can I put a command to the external process by use getOutputStream()?

#15084
From: Kevin
Date: Fri, 16 Jul 1999 00:00
33 lines
1538 bytes
Hi,
It's there again! I try to run a external process writen by C, so I use
Runtime() and get its getInputStream().... The first time when I put the
"begin_command" I really get the result from vprocess, and I hope the
vprocess would wait for the "second_command" then continue to finish its
process. I write the code below:

String init = begin_command;
try

    Runtime runtime = Runtime.getRuntime();
    Process vprocess = runtime.exec(init);
    is = new DataInputStream(vprocess.getInputStream());
    br = new BufferedReader(new InputStreamReader(is));
    os = new DataOutputStream(vprocess.getOutputStream());
    pr = new PrintWriter(new OutputStreamWriter(os),true);
} catch (IOException e) {}

public void do()
    String readin;
    try

        pr.write(second_command);
        while((readin = br.readLine()) != null)

            System.out.println(readin);
        }
    } catch (IOException e) {}
}

But I found "second_command" cannot be accept by vprocess, so I got nothing.
Where's wrong and how can I do?
Thanks advance!
Technical Details
Message-ID: <7mmian$76n3@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,96057074d0c2a5da,start
X-Google-Attributes: gidf74b3,public
From: "Kevin" <kevin1645@gcn.net.tw>
Subject: How can I put a command to the external process by use getOutputStream()?
Date: 1999/07/16
Message-ID: <7mmian$76n3@forums.borland.com>
X-Deja-AN: 501629115
Organization: Avery
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Newsgroups: borland.public.jbuilder.java.language