|
Swimmfree200 , the JVM can write to the screen can't it? Good becase that's all the terminal clear screen code needs.
Thanks for the insight.
[php]
import java.io.*;
public class RunCommand {
public static void main(String args[]) {
String s = null;
Process clear;
try {
clear = Runtime.getRuntime().exec("cls");
BufferedReader stdOut = new BufferedReader(new InputStreamReader(clear.getInputStream()));
while((s = stdOut.readLine()) != null)
System.out.print(s);
System.exit(0);
}
catch (IOException e) {
try {
clear = Runtime.getRuntime().exec("clear");
BufferedReader stdOut = new BufferedReader(new InputStreamReader(clear.getInputStream()));
while((s = stdOut.readLine()) != null)
System.out.print(s);
System.exit(0);
} catch(IOException d) {
System.out.println("Get a real machine:");
d.printStackTrace();
System.exit(-1);
}
}
}
}
[/php]
That program clears the screen or throws an IOException on any windows or unix machine with the commands "cls" or "clear" respectively.
__________________
Last edited by tempest; Oct 9th, 2005 at 10:48 AM.
|