JLine is a 100% pure java library for reading and editing console input. It is similar in functionality to BSD editline and GNU readline. People familiar with the readline/editline capabilities for modern shells (such as bash and tcsh) will find most of the command editing features of JLine to be familiar.
To run a quick demo of the functionality, download jline.jar and jline-demo.jar from the the SourceForge release page, and then run:
java -jar jline-demo.jar dictionary
I am interested in hearing which platforms this works for and which it does not: please let me know on the bug page.
The library is currently in beta, but basic features like line editing, command history, and customizable tab-completion work. See the javadoc for usage details, then download it here. For project details, see the SourceForge project page. Simple example usage can be found in the jline.example.Example class, included in the source jar.
If you want a more robust and complete console reading library, take a look at the java-readline wrapper for the native readline and editline libraries.
Important note: this library has only been tested on Linux and OSX, and relies on cbreak being turned off. The method Terminal.setupTerminal will automatically try to issue the appropriate stty commands to set up the console correctly. This works well under Linux and Mac OS X. Other UNIX platforms are untested. Windows XP is known to have some problems with tab-completion, but other line editing functions appear to work correctly. Feedback is greatly appreciated.