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


Groups > comp.lang.java.programmer > #19175 > unrolled thread

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

Started byvikaskumar sharma <vikaskumar615@gmail.com>
First post2012-10-06 06:55 -0700
Last post2012-10-07 08:12 -0700
Articles 11 — 6 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  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

#19175 — How to clear screen (as clrscr in c) in java?

Fromvikaskumar sharma <vikaskumar615@gmail.com>
Date2012-10-06 06:55 -0700
SubjectHow to clear screen (as clrscr in c) in java?
Message-ID<15180f00-917a-4456-a93f-55d88811c05c@vy11g2000pbb.googlegroups.com>
pls help me.if anyone knows how to clear screen of command prompt in
java as clrscr() in c language.

[toc] | [next] | [standalone]


#19176

FromJeff Higgins <jeff@invalid.invalid>
Date2012-10-06 10:58 -0400
Message-ID<k4pgkc$maf$1@dont-email.me>
In reply to#19175
On 10/06/2012 09: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.
You'll need to call some system specific code.
Google java+clrscr.

[toc] | [prev] | [next] | [standalone]


#19178

FromJeff Higgins <jeff@invalid.invalid>
Date2012-10-06 11:39 -0400
Message-ID<k4pj0v$6ri$1@dont-email.me>
In reply to#19176
On 10/06/2012 10:58 AM, Jeff Higgins wrote:
> On 10/06/2012 09: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.
> You'll need to call some system specific code.
> Google java+clrscr.
or java+curses

[toc] | [prev] | [next] | [standalone]


#19179

FromJeff Higgins <jeff@invalid.invalid>
Date2012-10-06 12:00 -0400
Message-ID<k4pk81$f3p$1@dont-email.me>
In reply to#19178
On 10/06/2012 11:39 AM, Jeff Higgins wrote:
> On 10/06/2012 10:58 AM, Jeff Higgins wrote:
>> On 10/06/2012 09: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.
>> You'll need to call some system specific code.
>> Google java+clrscr.
> or java+curses
And after all that googling simply - don't do it.
Use a proper GUI - it may even look and feel like a text terminal.

[toc] | [prev] | [next] | [standalone]


#19180

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-10-06 11:55 -0400
Message-ID<50705487$0$281$14726298@news.sunsite.dk>
In reply to#19179
On 10/6/2012 12:00 PM, Jeff Higgins wrote:
> On 10/06/2012 11:39 AM, Jeff Higgins wrote:
>> On 10/06/2012 10:58 AM, Jeff Higgins wrote:
>>> On 10/06/2012 09: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.
>>> You'll need to call some system specific code.
>>> Google java+clrscr.
>> or java+curses
> And after all that googling simply - don't do it.
> Use a proper GUI - it may even look and feel like a text terminal.

And that is good advice!

Arne

[toc] | [prev] | [next] | [standalone]


#19177

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-10-06 11:19 -0400
Message-ID<50704c23$0$290$14726298@news.sunsite.dk>
In reply to#19175
On 10/6/2012 9: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.

Use JNI to call clrscr.

Or use exex to call an external CLR command.

Arne

[toc] | [prev] | [next] | [standalone]


#19181

FromReal Gagnon <realgag+usenet@geocities.com>
Date2012-10-06 16:11 +0000
Message-ID<XnsA0E47C07866A4rgagnoncom@69.16.186.52>
In reply to#19175
> pls help me.if anyone knows how to clear screen of command prompt in
> java as clrscr() in c language.

One way is to use the Jansi library ( http://jansi.fusesource.org/ ).

See http://www.rgagnon.com/javadetails/java-0047.html

Bye.
-- 
Real Gagnon  from  Quebec, Canada
* Java, Javascript, VBScript or PowerBuilder snippets
* http://rgagnon.com/howto.html
* http://rgagnon.com/bigindex.html

[toc] | [prev] | [next] | [standalone]


#19182

FromKnute Johnson <nospam@knutejohnson.com>
Date2012-10-06 09:18 -0700
Message-ID<k4pll6$oca$1@dont-email.me>
In reply to#19175
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.

-- 

Knute Johnson

[toc] | [prev] | [next] | [standalone]


#19183

FromDonkey Hottie <donkey@fredriksson.dy.fi>
Date2012-10-07 14:14 +0300
Message-ID<rp48k9-hbt.ln1@tempest.fredriksson.dy.fi>
In reply to#19182
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.

[toc] | [prev] | [next] | [standalone]


#19185

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-10-07 09:02 -0400
Message-ID<50717d73$0$291$14726298@news.sunsite.dk>
In reply to#19183
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.

Arne

[toc] | [prev] | [next] | [standalone]


#19186

FromKnute Johnson <nospam@knutejohnson.com>
Date2012-10-07 08:12 -0700
Message-ID<k4s641$qf8$1@dont-email.me>
In reply to#19185
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web