File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes clearing the screen Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "clearing the screen" Watch "clearing the screen" New topic

clearing the screen

volsteni raj

Joined: Jan 27, 2005
Posts: 3
Can anyone provide code for clearing the screen in java code
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199


Welcome to JavaRanch!

There's no "clear the screen" API method in Java. You have two choices: you can print enough blank lines to push everything off the screen, or you can directly print a clear-screen control character (if your platform supports one.) Most UNIX terminals, and some versions of Windows if ANSI.SYS is installed, support ANSI control characters. See, for example, this.

[Jess in Action][AskingGoodQuestions]
Preetham Chandrasekhar
Ranch Hand

Joined: Nov 05, 2003
Posts: 98
printing blank lines is the option i know bout

"In theory, there is no difference between theory and practice. But, in practice, there is."<br /> - Jan L.A. van de Snepscheut
I agree. Here's the link:
subject: clearing the screen
It's not a secret anymore!