Creating Java Command Line Applications using jLine

Most common way of writing a command line application in java is to use BufferedReader to read user input. But if you want more features like tab completion, you have to write code to handle it from the scratch in BufferedReader method.

There is a nice library called jLine http://jline.sourceforge.net/ which can be used to write nice CLI apps without much effort. It has out of the box support for;

  • Command History 
  • Tab completion 
  • Line editing 
  • Custom Key Bindings 
  • Character masking
I've written simple sample application on how to use jLine. You can check that out in github https://github.com/sandarenu/sample-apps/tree/master/java-cli-app
 

Reader Comments

Hi Sandarenu.
Do you have other samples code to understand how jline works?

I don't succed using your code.

CAn you help me?

Thanks a lot

Silvio



Tribune to Heros

Tribune to Heros
We will never forget the sacrifices you made to protect our country....

Subscribe


Get Google Toolbar Button

Enter your email address:

Delivered by FeedBurner