Using usage() after parsing my parameters.

Skip to first unread message

Szymon Tosik

Jul 16, 2017, 8:52:30 AM7/16/17
to jcommander
Hey I'm wondering how could I use usage() method after probably all constructors which supported that have been deprecated. I'm doing as follows :

public class App {

private List<String> parameters = new ArrayList<>();

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

@Parameter(names = {"-t", "-type"}, description = "Type of file (file = f), (directory = d)")
private String type;

@Parameter(names = {"-e", "-ext"}, description = "Extension of files to be filtered")
private String extension;

@Parameter(names = "-wc", description = "Processor to be used during processing results")
private String processor;
@Parameter(names = "--help", help = true)
private boolean help = false;

public static void main(String[] args) throws FileNotFoundException, URISyntaxException {

App main = new App();
if( {
// display usage  

Hopefully there is some efficient way after parsing parameters to do so. Thanks for any help as I didn't find how to do so in documentation.

Cédric Beust ♔

Jul 16, 2017, 9:06:50 AM7/16/17
to jcommander

How about

    JCommander jc = JCommander.newBuilder()


    if( {

You received this message because you are subscribed to the Google Groups "jcommander" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit

Reply all
Reply to author
0 new messages