Posts

Showing posts from August, 2017

Java Command-Line Interfaces (Part 13): JArgs

Image
JArgs 1.0 has the distinction of being the subject of the 13th post of my series on parsing command line arguments in Java. JArgs is an open source ( BSD license ) library that has been primarily supported by different contributors including Steve Purcell and Ewan Mellor . It turns out that this can lead to some confusion when first using JArgs because package names and other details change depending on which version of JArgs you apply. The JArgs project page describes JArgs as "a convenient, compact, pre-packaged and comprehensively documented suite of command line option parsers for the use of Java programmers." The page asserts that JArgs might be selected over other Java-based command line processing libraries because JArgs is "easy to use, thoroughly tested, well documented and liberally licensed (BSD licence so no GNU messiness)." The page also states, "The package is small and without frills, but is functional, and contains code that has been in pr...

Java Command-Line Interfaces (Part 12): CLAJR

Image
The featured library for my twelfth post on processing command-line arguments in Java is Command-Line Arguments with Java Reflection (CLAJR). This "library" is a single Java source file ( CLAJR-0.9.java ) available for download on SourceForge . The main page for CLAJR currently shows a 2006 copyright date and the downloadable source zip file CLAJR-0.9-src.zip is dated 6 December 2008. Although CLAJR appears to be largely unsupported in recent years and although it's unlikely that I'd choose CLAJR over some of the alternative libraries already discussed in this series for processing command line arguments from Java code, I believe CLAJR warrants a post focused on it. There are some fairly unique characteristics of CLAJR that make it interesting, even if one chooses not to use it. CLAJR is not provided as a JAR. Instead, it's provided as a single zipped file with a single Java source code file contained in that ZIP file. Being available as a single source code f...

Java Command-Line Interfaces (Part 11): CmdLn

Image
This post describes using Ostermiller Java Utilities 1.08.02 's CmdLn (Java Command Line Parser) to process command-line arguments from Java-based applications. The Ostermiller Java Utilities include several different types of utilities , but the focus of this post is on the "Command Line Parser" that is described on the components page , "Handle options and arguments to Java command line programs." The Ostermiller Utilities command line parser does not use annotations, but instead employs the programmatic builder with fluent API concept that some of the other Java-based command-line parsing libraries have also used instead of annotations. The classes com.Ostermiller.util.CmdLn and com.Ostermiller.util.CmdLnOption are used together in the "definition" stage of command-line processing with CmdLn. This is demonstrated in the next code listing. "Definition" Stage of CmdLn Processing public static void main(final String[] arguments) { fin...

Java Command-Line Interfaces (Part 10): picocli

Image
The main picocli page describes picocli as "a mighty tiny command line interface" that "is a one-file Java framework for parsing command line arguments and generating polished, easily tailored usage help messages. With colors." This post provides a brief overview of applying Picocli 0.9.7 to process command line arguments in Java code. Like the other Java-based command line processing libraries covered in this series, picocli is open source . Because all of picocli's implementation exists in a single Java source code file , it's easy to use the source directly if desired. The picocli page emphasizes this, "A distinguishing feature of picocli is how it aims to let users run picocli-based applications without requiring picocli as an external dependency: all the source code lives in a single file, to encourage application authors to include it in source form ." If you'd rather use picocli as a library, there is a JAR available on the Maven Repo...