aspose file tools*
The moose likes I/O and Streams and the fly likes How to clear screen (clrscr) in java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "How to clear screen (clrscr) in java?" Watch "How to clear screen (clrscr) in java?" New topic
Author

How to clear screen (clrscr) in java?

Rajesh Tatooskar
Greenhorn

Joined: Nov 13, 2000
Posts: 2
How do I clear the screen (console) in java?
Something similar to clrscr() that is available in C?
Thanks,
Rajesh
Amit Gulhane
Greenhorn

Joined: Sep 03, 2003
Posts: 4
IF you are using Linux then try
print "\033[2J"
OR
print "\033[0;0f"
OR
char esc = 27;
String clear = esc + "[2J";
System.out.print(clear);
[ September 03, 2003: Message edited by: Amit Gulhane ]
Ray Muntz
Greenhorn

Joined: Oct 19, 2003
Posts: 3
But what if you have a diff OS. I for example have Win ME(Shoot me now!)
how would i go about this.
Thanks for any help on the subject.

P.s. does anyone know of a good site on Using the 'java.io' package? thanks
[ October 19, 2003: Message edited by: Ray Muntz ]

Fate favors Only those Brave enough to try.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8910
    
    8

Originally posted by Ray Muntz:
But what if you have a diff OS. I for example have Win ME(Shoot me now!)
how would i go about this.
Thanks for any help on the subject.

System.out.println("\n\n\n\n\n\n\. . .

P.s. does anyone know of a good site on Using the 'java.io' package? thanks
[ October 19, 2003: Message edited by: Ray Muntz ]


The Java Tutorial


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Ray Muntz
Greenhorn

Joined: Oct 19, 2003
Posts: 3
Thanks for the IO tutorial,
i was hoping there was another solution, but that seems to be all i can find as well. thanks anyway. i guess im just doomed to have no CLS... oh well.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8910
    
    8

Originally posted by Ray Muntz:

i was hoping there was another solution, but that seems to be all i can find as well. thanks anyway. i guess im just doomed to have no CLS... oh well.

There is another solution. I used JNI to use the Win32 console control routines. Of course, I've only tested it on Win2k. It should work on Win95-98. If you are really desperate, I will e-mail it to you.
Vinod Chandana
Ranch Hand

Joined: Aug 26, 2003
Posts: 59
Hi Ray,
U can try using Runtime and Process and then making a call to cls or clear based on ur os and then executing it. I havent tried it. I think this will work.
- Vinod.
Originally posted by Ray Muntz:
Thanks for the IO tutorial,
i was hoping there was another solution, but that seems to be all i can find as well. thanks anyway. i guess im just doomed to have no CLS... oh well.
 
 
subject: How to clear screen (clrscr) in java?