Hey everyone,

I've searched around Google a bit but most places suggest just using "\n" over and over. This gets messy though, for the code and the interface. Is there a built in method for Java that can clear the console?

Recommended Answers

You mean to say you want to achieve console clearance through Java code? Or your aim is to just clear console screen not considering the java code?

Jump to Post

All 3 Replies

You mean to say you want to achieve console clearance through Java code? Or your aim is to just clear console screen not considering the java code?

Through Java code.

There is no "pure Java" way of doing that. There are a couple of "curses" bindings floating around for Java but that's it. The mess of outputting a bunch of line feeds is nothing compared to considering using a full fledged JNI-dependent third party library just for a better console support.

But if you still insist, I'll leave this here. http://sourceforge.net/projects/javacurses/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.