Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #19183

Re: How to clear screen (as clrscr in c) in java?

Date 2012-10-07 14:14 +0300
From Donkey Hottie <donkey@fredriksson.dy.fi>
Newsgroups comp.lang.java.programmer
Subject Re: How to clear screen (as clrscr in c) in java?
References <15180f00-917a-4456-a93f-55d88811c05c@vy11g2000pbb.googlegroups.com> <k4pll6$oca$1@dont-email.me>
Message-ID <rp48k9-hbt.ln1@tempest.fredriksson.dy.fi> (permalink)

Show all headers | View raw


06.10.2012 19:18, Knute Johnson kirjoitti:
> On 10/6/2012 6:55 AM, vikaskumar sharma wrote:
>> pls help me.if anyone knows how to clear screen of command prompt in
>> java as clrscr() in c language.
>>
> 
> There is no similar method in Java.  Windows has a command "cls" that
> causes the DOS window to be cleared.  It is an internal command specific
> to Windows.  Linux has a "clear" command which scrolls the window up to
> clear it.
> 
> You could duplicate the Linux style clear command easily enough,
> although I don't know of any way to determine how many lines the window
> has.  It may be possible to use Runtime.exec to issue these commands but
> I've never been able to get it to work.
> 
>   You should take a look at the Console class if you are going to do a
> terminal based program.
> 

Pressing ctrl+l from keyboard clears the Linux console. Maybe
System.out.print(CTRL_L); will do it? I did not test..

-- 

You have an unusual equipment for success.  Be sure to use it properly.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to clear screen (as clrscr in c) in java? vikaskumar sharma <vikaskumar615@gmail.com> - 2012-10-06 06:55 -0700
  Re: How to clear screen (as clrscr in c) in java? Jeff Higgins <jeff@invalid.invalid> - 2012-10-06 10:58 -0400
    Re: How to clear screen (as clrscr in c) in java? Jeff Higgins <jeff@invalid.invalid> - 2012-10-06 11:39 -0400
      Re: How to clear screen (as clrscr in c) in java? Jeff Higgins <jeff@invalid.invalid> - 2012-10-06 12:00 -0400
        Re: How to clear screen (as clrscr in c) in java? Arne Vajhøj <arne@vajhoej.dk> - 2012-10-06 11:55 -0400
  Re: How to clear screen (as clrscr in c) in java? Arne Vajhøj <arne@vajhoej.dk> - 2012-10-06 11:19 -0400
  Re: How to clear screen (as clrscr in c) in java? Real Gagnon <realgag+usenet@geocities.com> - 2012-10-06 16:11 +0000
  Re: How to clear screen (as clrscr in c) in java? Knute Johnson <nospam@knutejohnson.com> - 2012-10-06 09:18 -0700
    Re: How to clear screen (as clrscr in c) in java? Donkey Hottie <donkey@fredriksson.dy.fi> - 2012-10-07 14:14 +0300
      Re: How to clear screen (as clrscr in c) in java? Arne Vajhøj <arne@vajhoej.dk> - 2012-10-07 09:02 -0400
        Re: How to clear screen (as clrscr in c) in java? Knute Johnson <nospam@knutejohnson.com> - 2012-10-07 08:12 -0700

csiph-web