← Back to home

They say that a Java framework is not complete until it provides factories, and since it’s something that JCommander was still lacking, it had to be fixed.

Introducing JCommander 1.4.

Here is what’s new:

  • You can now specify default values in a more flexible way than at field declaration time (documentation).
  • You can use string converter factories instead of specifying converter classes on each @Parameter annotation (documentation).
  • The usage is now prettier:
    Usage: <main class> [options]
      Options:
        -debug          Debug mode (default: false)
        -groups         Comma-separated list of group names to be run
      * -log, -verbose  Level of verbosity (default: 1)
        -long           A long number (default: 0)
  • Many bug fixes and a more clever option parsing to cover odd cases.
  • This release actually contains more features but I’m not telling. All the goodness available at the usual place. Operators are standing by, order now!

Comments (7)

Dmitri

Thanks! That was a really quick turn-around time on the new features.

Duncan McGregor

Very nice, thank you. One question - can I replace in the usage, or get the message as a string to replace it myself? Cheers

Duncan McGregor

Oh, stupid comment sanitizers! Let's try can I replace &gt;main class&lt; in the usage

Duncan McGregor

Ah well, you get the drift ;-)

Cedric

Hi Duncan, Yes, in the upcoming version, you can call JCommander#setProgramName() (you can get it from github if you want to try it now).

Duncan McGregor

On reflection (no pun intended;-) it would be handy to get at the usage as a string. That way when my Swing app is invoked badly it can print the usage in a message box rather than to the console that isn't there. Maybe I'll have a trawl through the source... Cheers Duncan

JCommander: Gestor de Archivos Java y Utilidad Java para gestionar par??metros por l??nea de comandos &laquo; Java Mania

[...] su blog pod??is leer algo m??s sobre la nueva versi??n: JCommander [...]