13 Replies - 1900 Views - Last Post: 14 June 2009 - 04:08 PM Rate Topic: -----

#1 sakshamkum   User is offline

  • D.I.C Head
  • member icon

Reputation: 19
  • View blog
  • Posts: 232
  • Joined: 09-June 09

Clearing console windows

Posted 12 June 2009 - 11:34 PM

Hi,

Is there any way to clear screen of the standard output[Dos] in java




*Edited for a more meningfull title
Give your topic a descriptive title, NOT "Help" or "Plz Help Me" or "I'm a noob"
Or "General Java" in a Java forum is kind of useless

This post has been edited by pbl: 13 June 2009 - 09:14 AM

Is This A Good Question/Topic? 0
  • +

Replies To: Clearing console windows

#2 virgul   User is offline

  • D.I.C Regular

Reputation: 44
  • View blog
  • Posts: 269
  • Joined: 18-March 09

Re: Clearing console windows

Posted 12 June 2009 - 11:40 PM

if your using something like bluej a really easy way to do it is this

//the \ might be the other way, i cant remember
System.out.println(\f);


Was This Post Helpful? 0
  • +
  • -

#3 pbl   User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8381
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: Clearing console windows

Posted 13 June 2009 - 09:13 AM

View Postsakshamkum, on 12 Jun, 2009 - 10:34 PM, said:

Hi,

Is there any way to clear screen of the standard output[Dos] in java


http://sourceforge.n...cts/javacurses/
Was This Post Helpful? 0
  • +
  • -

#4 g00se   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3744
  • View blog
  • Posts: 17,121
  • Joined: 20-September 08

Re: Clearing console windows

Posted 13 June 2009 - 10:12 AM

Quote



I'm pretty certain that's Unix-only, but i'd be glad if i were wrong..

This post has been edited by g00se: 13 June 2009 - 10:13 AM

Was This Post Helpful? 0
  • +
  • -

#5 pbl   User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8381
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: Clearing console windows

Posted 13 June 2009 - 01:19 PM

View Postg00se, on 13 Jun, 2009 - 09:12 AM, said:

Quote



I'm pretty certain that's Unix-only, but i'd be glad if i were wrong..

you're right must be based on XCurse library as its name implies
Sorry
i'll have another look around
Was This Post Helpful? 0
  • +
  • -

#6 KYA   User is offline

  • Wubba lubba dub dub!
  • member icon

Reputation: 3213
  • View blog
  • Posts: 19,241
  • Joined: 14-September 07

Re: Clearing console windows

Posted 13 June 2009 - 01:24 PM

The general consensus is to just do System.out.println() 20 times. :)
Was This Post Helpful? 0
  • +
  • -

#7 pbl   User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8381
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: Clearing console windows

Posted 13 June 2009 - 01:45 PM

OK, this one is not OS specific

http://sourceforge.net/projects/jline/
Was This Post Helpful? 0
  • +
  • -

#8 g00se   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3744
  • View blog
  • Posts: 17,121
  • Joined: 20-September 08

Re: Clearing console windows

Posted 13 June 2009 - 02:02 PM

Unfortunately:

Quote

Is JLine a full-featured curses implementation?

No: JLine has no ability to position the cursor on the console. It might someday evolve into a plausible Java curses implementation.
Known Bugs

* Clearing the screen (CTRL-L) doesn't currently work on Windows.

Was This Post Helpful? 0
  • +
  • -

#9 pbl   User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8381
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: Clearing console windows

Posted 13 June 2009 - 07:26 PM

View Postg00se, on 13 Jun, 2009 - 01:02 PM, said:

Unfortunately:

Quote

Is JLine a full-featured curses implementation?

No: JLine has no ability to position the cursor on the console. It might someday evolve into a plausible Java curses implementation.
Known Bugs

* Clearing the screen (CTRL-L) doesn't currently work on Windows.

So G00se is there an easy way to send a <CTRL>L by System.out.print) ?
Was This Post Helpful? 0
  • +
  • -

#10 g00se   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3744
  • View blog
  • Posts: 17,121
  • Joined: 20-September 08

Re: Clearing console windows

Posted 14 June 2009 - 12:42 AM

Quote

So G00se is there an easy way to send a <CTRL>L by System.out.print) ?


Not that i know of i'm afraid. KYA's answer is probably as good as it gets on Windows.

Oh hang on, there's a faint possibility: have a look at Powershell for Windows, which is a free .NET-based extension from Microsoft, giving Unix-like control over a command line shell. There could be something in there ...
Was This Post Helpful? 0
  • +
  • -

#11 pbl   User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8381
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: Clearing console windows

Posted 14 June 2009 - 01:02 PM

I tried

char ctrlL = 11;
System.out.print(ctrlL);

but without success
Was This Post Helpful? 0
  • +
  • -

#12 c0mrade   User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 412
  • Joined: 16-November 07

Re: Clearing console windows

Posted 14 June 2009 - 02:44 PM

Yeah when I had a requirement to do this I just outputted a bunch of new lines and had the new output appear at the bottom of the shell instead of the top.
Was This Post Helpful? 0
  • +
  • -

#13 pbl   User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8381
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: Clearing console windows

Posted 14 June 2009 - 03:59 PM

Don't tell me KYA is right

The general consensus is to just do System.out.println() 20 times.
Was This Post Helpful? 0
  • +
  • -

#14 Locke   User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 552
  • View blog
  • Posts: 5,624
  • Joined: 20-March 08

Re: Clearing console windows

Posted 14 June 2009 - 04:08 PM

View Postpbl, on 14 Jun, 2009 - 04:59 PM, said:

Don't tell me KYA is right

The general consensus is to just do System.out.println() 20 times.


It's a workaround...but he's right. :lol:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1