This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
    Bookmark Topic Watch Topic
  • Mark post as helpful
  • send pies
  • Report post to moderator
There are several alternatives. You can print a bunch of blank lines and push all the text off the screen that way. If you don't mind some degree of platform lock-in, you can use JNI to make a system call, which of course ties you to one specific platform. You may be able to use Runtime.exec() to execute an external command.

Another option which works on many platforms is to use ANSI terminal-control escape sequences. By merely printing a few special characters, you can clear a window, print colored text, and perform other nifty tricks on any platform that supports ANSI escape characters, which includes Linux, Mac OS/X, and Windows (if the ANSI.SYS driver is installed.)

A pure Java library for console control (which also supports color and other console options) is the JChassis ANSI Terminal Controller.

There is a Java Curses Library available for both Unix-like and Windows platforms (curses being a terminal library on Unix-like systems). This is a full-fledged AWT-like text console windowing toolkit including dialogs, lists, scrollbars and so on.
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!