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


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

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

From Knute Johnson <nospam@knutejohnson.com>
Newsgroups comp.lang.java.programmer
Subject Re: How to clear screen (as clrscr in c) in java?
Date 2012-10-07 08:12 -0700
Organization A noiseless patient Spider
Message-ID <k4s641$qf8$1@dont-email.me> (permalink)
References <15180f00-917a-4456-a93f-55d88811c05c@vy11g2000pbb.googlegroups.com> <k4pll6$oca$1@dont-email.me> <rp48k9-hbt.ln1@tempest.fredriksson.dy.fi> <50717d73$0$291$14726298@news.sunsite.dk>

Show all headers | View raw


On 10/7/2012 6:02 AM, Arne Vajhøj wrote:
> On 10/7/2012 7:14 AM, Donkey Hottie wrote:
>> 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..
>
> Very unlikely.
>
> Typical there is a big difference between input and output.
>
> It is 25 years since I have last seen a half duplex terminal.

I haven't thought about one in at least that long :-).

-- 

Knute Johnson

Back to comp.lang.java.programmer | Previous | NextPrevious 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