How do I parse command line arguments in Java?

Check these out: http://commons.apache.org/cli/ http://www.martiansoftware.com/jsap/ Or roll your own: http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html For instance, this is how you use commons-cli to parse 2 string arguments: import org.apache.commons.cli.*; public class Main { public static void main(String[] args) throws Exception { Options options = new Options(); Option input = new Option(“i”, “input”, true, “input file path”); input.setRequired(true); options.addOption(input); Option … Read more

Best way to parse command line arguments in C#? [closed]

I would strongly suggest using NDesk.Options (Documentation) and/or Mono.Options (same API, different namespace). An example from the documentation: bool show_help = false; List<string> names = new List<string> (); int repeat = 1; var p = new OptionSet () { { “n|name=”, “the {NAME} of someone to greet.”, v => names.Add (v) }, { “r|repeat=”, “the … Read more