Java: Clear the console -
can body please tell me code used clear screen in java? example in c++ system("cls"); what code used in java clear screen? thanks! since there several answers here showing non-working code windows, here clarification: runtime.getruntime().exec("cls"); this command not work, 2 reasons: there no executable named cls.exe or cls.com in standard windows installation invoked via runtime.exec , well-known command cls builtin windows’ command line interpreter. when launching new process via runtime.exec , standard output gets redirected pipe initiating java process can read. when output of cls command gets redirected, doesn’t clear console. to solve problem, have invoke command line interpreter ( cmd ) , tell execute command ( /c cls ) allows invoking builtin commands. further have directly connect output channel java process’ output channel, works starting java 7, using inheritio() : import java.io.ioexception; public class cls { p...