Process, How to use Outputstream to send the message two times
<p>This is my code:</p>

<pre><code>Process p=Runtime.getRuntime().exec("something command"); 

String s;

JFrame frame = new JFrame();
frame.setSize(600, 400);
JTextField A = new JTextField();
A.addActionListener(new ActionListener(){

@Override
public void actionPerformed(ActionEvent e) {
    String s = A.getText();
    System.out.println("I send a text: " + s);
    try{
         p.getOutputStream().write(s.getBytes());
         p.getOutputStream().close();
    }catch(Exception ex){
        ex.printStackTrace();
    }
    A.setText("");
}    
});
frame.add(A);
frame.setVisible(true);


// Read command standard input
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ((s = stdInput.readLine()) != null) {
   System.out.println(s);
}
</code></pre>

<p>I want to use p.getOutputStream() to send the message two times, but the problem is I need to close the OutputStream to send. I can't send again because it have been closd. Can I reconnect the OutputStream or no need to close the OutputStream?</p>

<p>Thx:)</p>