esuslogo
 [To advertise Java(tm) Events here, contact joris@esus.com!]
banner

Java™
by example!






New @ Esus.com


  gb  In-house search engine for better results!

  gb  Get updates with the esus.com
newsletter!









  Home 
 Browse Categories 
 Ask a Java Question 
 Help 
  For Java Tips & Tricks, subscribe to the esus.com newsletter!
Search Java Q&A, Links, API's:   adv 

How do I clear the terminal screen in a Java application?
There are a couple ways to do this. One way is to execute a number of System.out.println's:

This code sample is only viewable to esus.com members
Login or become a member!



You can also use the Runtime object and execute (in Windows):

This code sample is only viewable to esus.com members
Login or become a member!

or call a batch file containing CLS. However, this won't work as it is executed on the newly created process.

In Windows, you can send the ANSI escape sequence for CLS to the terminal:

This code sample is only viewable to esus.com members
Login or become a member!


Make sure you have installed the ANSI device driver. To do this, enter this line in your config.sys file:

This code sample is only viewable to esus.com members
Login or become a member!



Finally, you can write a C program that clears the screen and call this method through JNI.


Further Information
Author of answer: Joris Van den Bogaert

Comments
Comments to this answer are only viewable by members. Login or become a member!





Terms of Service | Privacy Policy | Contact

Copyright © 2000-2003 Esus.com - All Rights Reserved 
Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. Esus.com is independent of Sun Microsystems, Inc. All other trademarks are the sole property of their respective owners.