Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Beginning Java and the fly likes Clear Screen Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Clear Screen" Watch "Clear Screen" New topic

Clear Screen

Anju Aravind

Joined: Nov 01, 2001
Posts: 3
Would any one mind helping me with one doubt.
How do you print something on to the Dosprompt and
then it should clear the screen and print something
Junilu Lacar

Joined: Feb 26, 2001
Posts: 4445

I haven't tried this myself but this page may have the information you need. You need the ANSI.SYS device driver loaded then I suppose you could System.out.print <ESC>[2J

Junilu Lacar
Sun Certified Programmer for the Java� 2 Platform

Junilu - [How to Ask Questions] [How to Answer Questions]
Anju Aravind

Joined: Nov 01, 2001
Posts: 3
Junilu Lacar
That was not very clear.
Let me explain a bit more what exactly i want.
if you need to write a program to print the time and it should change on the dosprompt as the time changes ie; i want to clear the screen and print the new time each sec . What is the code for that.
Thanks a lot for your help
Anju Aravind
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9044
Check out this thread

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
kumar abhay
Ranch Hand

Joined: Oct 02, 2001
Posts: 53
hi there,
i read your question,even though i do not have that much knowledge of java just a begginer but can give you a idea.try double dimenssional array & in that use the ASCII code for space n print it column n row wise & try to print space on DOS PROMPT as the printing of spaces column wise &row wise comes to end,the statement whatever you wish to print ,would be printed.
i hope this would solve your problem.
kumar abhay
Anju Aravind

Joined: Nov 01, 2001
Posts: 3
Thank you very much guys. that was exactly what I was looking for

Anju Aravind
I agree. Here's the link:
subject: Clear Screen
Similar Threads
Clear Screen in java?
palindrome program
clearing the screen
About I/O
Need Help with printing