What's this doing in the WLS forum? :roll: Oh well...
I think the CLS command in windoze is a "builtin" (to borrow a term from unix), and not an executable itself.
So you are probably going to have to exec something like "CMD /C CLS" or whatever. Not really sure. And this probably will only work on NT/Win2k - I think you may have to do something different on Win95/98.
In unix, the best you can do is the clear command, which asks terminfo about how to do a clear screen on the current terminal type. But note that just talks to the tty. If you are running the terminal in X, clear won't handle cases where your terminal (xterm, konsole, gnome-terminal, etc) is keeping history (scrollbar). You might be able to figure out how to signal the terminal to erase its history, but it'd be different for each one. I used to know how to do this for xterm (in vt100 mode), but those brain cells are long gone.
But if I ran your program and it cleared
my terminal history, I'd be upset. I might have done something useful up there that I want to keep.
If you really need to have a universal "console" that does what you want, then you're probably going to have to write it in awt/swing....