Hi, this thread probably exists, but not good answers for me. How can I clear screen in Java? Im using NetBeans and his output.
Thanks for your response.
Printable View
Hi, this thread probably exists, but not good answers for me. How can I clear screen in Java? Im using NetBeans and his output.
Thanks for your response.
Are you clearing your terminal/console/Command-prompt or some sort of GUI Interface.
If you are talking about your terminal/console/Command-prompt, then there are many ways to do this depending on the OS and how your implement this.
For example, In Linux you could just do this.
There is a command in linux that does this already. I bet there is one for Windows as well... I think there is a clear program on windows as well but I am not too sure. If using external programs is not your cup of tea then this should work for you!Code:Runtime.getRuntime.exec("clear");
Code:public class Clear {
public static void main(String args[]) {
final String clear = "\033[";
System.out.print(clear + "2J"); System.out.flush();
}
}