Starting xterm using exec and then send commands to it
843798May 19 2005 — edited May 19 2005Hello
I don�t get this to work. I start xterm in my UNIX environment by dong the following:
try {
process = Runtime.getRuntime().exec("xterm");
} catch (IOException e) {
e.printStackTrace();
}
So long, so good. Now I want to send my xterm a command, and I try this:
BufferedOutputStream bos = new BufferedOutputStream(process.getOutputStream());
byte[] command;
try{
bos.write(command, 0, command.length);
bos.write(newline.getBytes());
bos.flush();
System.out.println("Sending command");
} catch (IOException ioe) {
ioe.printStackTrace();
}
The string "Sending command" appears but nothing else happens, not even an exception. The idea is that e.g. the command "exit" should close the xterm.
Thank you for anything.
// Adde