• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Clear Screen

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me how can I clear the Dos screen of a Java program. I know if you put a "\r" directive in the print statement that it will remove all the elements in the current line. Yet, this doesn't help with multiple lines of output. Can anyone help me with this
 
Ranch Hand
Posts: 1246
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have u tried call the system dos command "cls"?
I know i know.... if i do that it wouldn't work for other system.
Just a suggestion.

 
Sheriff
Posts: 15815
264
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Do a search in Java in General (beginner) for the phrase "clear screen" - you'll find a number of threads already discuss this.
2. Try the following (works for me on win98)
System.out.println("\u001B[2J");
For it to work, you need to have ANSI.sys installed as a device driver. Look in your config.sys file and if you see if it includes a line like
device=c:\windows\command\ansi.sys
If not, find ansi.sys and add an appropriate line to config.sys
Good luck!
Junilu
 
Be reasonable. You can't destroy everything. Where would you sit? How would you read a tiny ad?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic