JLine Manual


JLine is a Java library for handling 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.


JLine has no library dependencies, aside from a JVM of version 1.2 or higher. To install JLine, download the jline.jar file, and either place it in the system-wide java extensions directory, or manually add it to your CLASSPATH. The extensions directory is dependent on your operating system. Some few examples are:

  • Macintosh OS X: /Library/Java/Extensions or /System/Library/Java/Extensions
  • Microsoft Windows: JAVAHOME\jre\lib\ext (example: C:\j2sdk1.4.1_03\jre\lib\ext)
  • UNIX Systems: JAVAHOME/jre/lib/ext (example: /usr/local/java/jre/lib/ext)

JLine is not 100% pure Java. On Windows, it relies on a .dll file to initialize the terminal to be able to accept unbuffered input. However, no installation is necessary for this: when initialized, JLine will dynamically extract the DLL to a temporary directory and load it. For more details, see the documentation for the jline.WindowsTerminal class.

On UNIX systems (including Macintosh OS X), JLine will execute the stty command to initialize the terminal to allow unbuffered input. For more details, see the documentation for the jline.UnixTerminal class.

For both Windows and UNIX systems, JLine will fail to initialize if it is run inside a strict security manager that does not allow the loading of libraries, writing to the file system, or executing external programs. However, for most console applications, this is usually not the case.

Frequently Asked Questions

Can I disable JLine if it isn't working on my platform?

You can disable JLine by setting the System property "jline.terminal" to "jline.UnsupportedTerminal". For example:

java -Djline.terminal=jline.UnsupportedTerminal jline.example.Example simple

How do I customize the key bindings?

You can create your own keybindings by creating a HOME/.jlinebindings.properties" file. You can override the location of this file with the "jline.keybindings" system property. To examine the format to use, see the src/jline/keybindings.properties file in the source distribution.

Can I use JLine as the input handler for BeanShell?

Yes. Try running:

java jline.ConsoleRunner bsh.Interpreter

Can I use JLine as the input handler for jdb (the java debugger)?

Yes. Try running:

java jline.ConsoleRunner com.sun.tools.example.debug.tty.TTY args

Is JLine a full-featured curses implementation?

No: JLine has no ability to position the cursor on the console. It might someday evolve into a plausible Java curses implementation.

Known Bugs

  • Clearing the screen (CTRL-L) doesn't currently work on Windows.


The following people have contributed to improving JLine over the years:

  • Marc Prud'hommeaux
  • Damian Steer
  • Dale Kemp
  • Jun Liu
  • malcolm@epcc.ed.ac.uk
  • Simon Patarin
  • Amy Isard
  • Ryan Bell
  • Marc Herbert
  • Christian Salm

Future enhancements

  • Add localization for all strings.
  • Create a BNFCompletor that can handle any BNF.

Change Log

    0.9.93 2007-11-13

  • Fixed backspace handling on Unix/OS X.

    0.9.92 2007-10-30

  • JLine now works with 64-bit Windows systems.

    0.9.91 2007-03-11

  • Added ConsoleReader.setUsePagination() method which allows configuration of pagination when the number of rows of candidates exceeds the height of the detected terminal, thanks to a patch by Damian Steer.
  • Better support for UTF-8 inputs (issue #1623521).
  • Improved list of supported keys on Windows (issue #1649790).

    0.9.5 2006-03-08

  • Fixed problem with "stty" on Solaris, which doesn't understand "stty size" to query the terminal size. It now uses "stty -a", which supposedly outputs a POSIX standard format.
  • Support HOME and END keys, thanks to a patch by Dale Kemp.

    0.9.1 2005-01-29

  • Fixed problem with the 0.9.0 distribution that failed to include the Windows jline.dll in the jline.jar, rendering it inoperable on Windows.
  • Implemented proper interception or arrow keys on Windows, meaning that history can now be navigated with the UP and DOWN keys, and line editing can take place with the LEFT and RIGHT arrow keys.

    0.9.0 2005-01-23

  • Changed license from GPL to BSD.
  • Made "CTRL-L" map to clearing the screen.

    0.8.1 2003-11-18

  • Fixed accidental dependency on JVM 1.4.

    0.8.0 2003-11-17

  • Windows support using a native .dll
  • A new ClassNameCompletor
  • Many doc improvements

    0.6.0 2003-07-08

  • Many bugfixes
  • Better release system
  • Automatically set terminal property by issuing stty on UNIX systems
  • Additional tab-completion handlers
  • Tested on Debian Linux and Mac OS 10.2
  • Example includes dictionary, filename, and simple completion

    0.3.0 2002-10-05

  • Initial release