Win a copy of Java Challengers this week in the Java in General forum!
    Bookmark Topic Watch 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
The harder I work, the luckier I get. -Sam Goldwyn So tiny. - this ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic