Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

clear screen

Status
Not open for further replies.

nitha

Programmer
Feb 4, 2003
5
0
0
IN
plz tell me how to clear screen(console) in java

nitha
 
Well, there is no method in Java to clear the screen(not what I know about)

What you can do is to use the OS commands to do this.

If you are running Linux, *BSD or something else look a like you can try this code, it will work fine.



public void cleerScreen() throws IOException
{

Process p = Runtime.getRuntime().exec("clear");
String line = "";
BufferedReader out = new BufferedReader (new InputStreamReader (p.getInputStream() ) );

while( ( line=out.readLine() ) != null)
{
System.out.println(line);
}

}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top