Java CLI UI-design: frameworks or libraries?

12,334

Solution 1

Perhaps CLI Toolkit...

http://alexis.royer.free.fr/CLI/

Solution 2

You can also have a look and Clamshell-cli or spring shell:

  • Clamshell-cli is relatively simple and easy to use : You can look at jmx-cli to get a nice example of what can be done with it.

  • Spring Shell is bigger but more feature-full (tab completion, etc). It has been extracted from spring Roo and released as an independent framework

Solution 3

There is a project called JLine that provides cross-platform support for general command-line input handling:

http://jline.sourceforge.net/

More of a support library than a framework though.

Solution 4

Try searching for CURSES and java, something like http://www.google.co.uk/search?q=curses+for+java . Long time ago CHARVA ( http://www.pitman.co.za/projects/charva/index.html ) looked nice.

Share:
12,334

Related videos on Youtube

Fuu
Author by

Fuu

By day: Saving the internet By night: Observing from a high vantage point

Updated on April 18, 2022

Comments

  • Fuu
    Fuu about 2 years

    I'm currently working on a small utility program that only requires a command line interface, and I started wondering if Java provided any standard way of creating the CLI, in a similar way that Swing and the likes exist for GUIs. I'm not really interested in command line parameters and parsing of them, but rather the command based interaction the user has with the program to use it. This is for the situations where GUI simply is unnecessary or not an option for using the program.

    Googling the subject pretty much only results in tutorials on how to use BufferedReader and the likes to do rudimentary interaction with the user, aimed at people learning the basics of Java and writing simple UI that asks for name and prints "Hello World!" etc..

    Are the any libraries that are focused on providing a good framework for quickly implementing a more complex CLI UI or is this really something that everyone implements in ad hoc manner for their own utilities?

    Maybe someone knows of patterns for the implementation that were created back in time when not everything was graphical? That would also be useful resource.

    • sateesh
      sateesh over 14 years
      Wouldn't Apache Commons CLI (commons.apache.org/cli) help you ?
    • Fuu
      Fuu over 14 years
      No, Apache Commons CLI is really made for parsing command line arguments and doesn't really contribute to design or implementation of the UI otherwise.
  • Riduidel
    Riduidel over 14 years
    Indeed, there is no real framework for embedding CLI in Java, and jline is the most prominent library for such a work. I think it is used, as an example, for the groovy interpreter in command line mode.
  • Fuu
    Fuu over 14 years
    Interesting links, these take the approach of basically porting Swing/AWT GUI into text based terminal. Problem is that it doesn't reduce the development effort that is the goal of quick CLI UI, since then you might as well do it in Swing and have a graphical interface. :)
  • Fuu
    Fuu over 14 years
    Looking at JLine, it would help mostly by providing autocompletion for typed commands. Useful, but doesn't really meet the criteria.
  • Fuu
    Fuu over 12 years
    This looks like a nice approach, definitely the most relevant so far.
  • nilo de roock
    nilo de roock over 12 years
    Unfortunately it requires cgywin on Windows.