• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Clearing console

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello.
I need help with clearing console. What's the right way to do this with Jline or JCurses?
Thank you.
 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

We have an FAQ about that very question.
 
Campbell Ritchie
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually that might not be as useful as I thought. Maybe here.
Try the clear command. There appears to be a pair of escape sequences, mentioned in that thread.
 
Michael Rusev
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Campbell Ritchie, not working.
Actually, I need help with using the libraries I mentioned. I've tried everything else I found.
 
Campbell Ritchie
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So what went wrong?

This is too difficult for this forum, so I shall move the discussion.
 
Michael Rusev
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nothing. It's merely not working. I'm using Windows.
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Michael Rusev wrote:Nothing. It's merely not working. I'm using Windows.


Please read our FAQ on why "It Doesn't Work" is useless, and then come back here and give us more information.
 
Michael Rusev
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Used http://stackoverflow.com/questions/2979383/java-clear-the-console?answertab=votes#tab-top.
And it didn't clear my console.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you mean the first answer in that SO post, then yeah, what it does is to create a new process and clear its console. Which isn't what you want. Later in that post there's an example using JLine which claims to work -- there aren't any comments on it and I have no idea whether it does or not. (Since I haven't had the need to write a non-trivial console-based application since the last century at least.) If you're considering JLine as a possibility then I'd suggest you try it and see what happens.
 
Michael Rusev
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know how I have missed it.
It works but I have to print with the ConsoleReader class. And it supports only strings. I suppose I have to find a better way.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand that. Everything you send to a text-based output device like a console is going to be converted to a string anyway, because what the user sees in that console is text characters. So this non-string stuff that you need to print: just convert it to strings.
 
Michael Rusev
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since I have already built my project it will be a bit inconvenient to do this.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A "bit inconvenient" compared to what other options?
 
Michael Rusev
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To nothing it seems.
I'm using this:
 
reply
    Bookmark Topic Watch Topic
  • New Topic