I wanted to write an application for windows/mac/linux and I chose java because a java developer friend told me Java is platform independent.
I came to a problem where I wanted to clear the console (to make the reading easier on the user).
I've tried System.out.flush();
and Runtime.getRuntime().exec("cls");
.
It seems the only real solution is to use a hack (and smelly code is bad) - Java: Clear the console (check "Dyndrilliac" answer).
The reason using this hack is bad, as other users have commented on "Dyndrilliac" answer, what happens when Microsoft or Apple changes the command name from "cls" or "clear" to something different? It pretty much breaks your application and you get an error (such as "command not recognized") from the OS Company.
So my question is: did Java decide not to implement a library that handles clearing console outputs due to keeping it up to date whenever Windows/Macs/Linux decides to change it's command names? Or did Java implement a library for handling this, and I just can't find it?