Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Command line parsing framework for Java
Java Other
Latest commit e99874e @cbeust Update kobalt
Failed to load latest commit information.
doc Gradle info
gradle Gradle 2.3.
kobalt/wrapper Update kobalt
src Test fix.
.gitignore Add kobalt build.
.travis.yml No more log
Build.kt Don't need gson.
CHANGELOG Better error message when there's a visibility problem.
README.markdown Fix link
build-with-maven Fix build script.
build.gradle TestNG 6.9.4.
gradlew +x flag for gradlew
kobaltw Update kobalt
license.txt Updated license Updated the pom
pom.xml TestNG 6.9.5.
release Changed profile name to 'sign'
upload 1.27



This is an annotation based parameter parsing framework for Java.

Here is a quick example:

public class JCommanderTest {
    public List<String> parameters = Lists.newArrayList();

    @Parameter(names = { "-log", "-verbose" }, description = "Level of verbosity")
    public Integer verbose = 1;

    @Parameter(names = "-groups", description = "Comma-separated list of group names to be run")
    public String groups;

    @Parameter(names = "-debug", description = "Debug mode")
    public boolean debug = false;

    @DynamicParameter(names = "-D", description = "Dynamic parameters go here")
    public Map<String, String> dynamicParams = new HashMap<String, String>();


and how you use it:

JCommanderTest jct = new JCommanderTest();
String[] argv = { "-log", "2", "-groups", "unit1,unit2,unit3",
                    "-debug", "-Doption=value", "a", "b", "c" };
new JCommander(jct, argv);

Assert.assertEquals(2, jct.verbose.intValue());
Assert.assertEquals("unit1,unit2,unit3", jct.groups);
Assert.assertEquals(true, jct.debug);
Assert.assertEquals("value", jct.dynamicParams.get("option"));
Assert.assertEquals(Arrays.asList("a", "b", "c"), jct.parameters);

The full doc is available at

Something went wrong with that request. Please try again.