only more one question:
I write in the output several times, but the input only can be read when the process "p" is finished (command "\n").
How can I do to allow the reading of input at each writing in the output?
thanks,
code for
test only:
public class Teste {
public static void main (String args[])
{
Process p;
InputStream input,inputErr;
OutputStream output;
try{
p = Runtime.getRuntime().exec("prosoft-reduce");
input = p.getInputStream();
output = p.getOutputStream();
inputErr = p.getErrorStream();
InputStreamReader reader = new InputStreamReader(input);
BufferedReader bufferReader = new BufferedReader(reader);
OutputStreamWriter writer = new OutputStreamWriter(output);
BufferedWriter bufferWriter = new BufferedWriter(writer);
InputStreamReader errorReader = new InputStreamReader(inputErr);
BufferedReader errorBufferReader = new BufferedReader(errorReader);
String command;
String line = "";
command = JOptionPane.showInputDialog(null,"command");
while (!command.equals("")) {
bufferWriter.write(command+"\n");
bufferWriter.flush();
/*while (line!=null){
System.out.println(line);
line = bufferReader.readLine();
}*/
System.out.println(line);
command = JOptionPane.showInputDialog(null,"command");
}
bufferWriter.write("\n");
bufferWriter.flush();
line = "";
while (line!=null){
System.out.println(line);
line = bufferReader.readLine();
}
line = "";
while (line!=null){
System.out.println(line);
line = errorBufferReader.readLine();
}
}
catch(IOException e)
{
e.printStackTrace();
}
System.exit(0);
}
}