At the moment I'm wrangling with an existing Java project, my goal is to create a command line interface for passing arguments to it, to "run" it, so to speak.
I'm using the Apache commons cli library, like so:
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
public class CommandLineParameters {
  public static void main(String[] args) {
    CommandLineParser parser = new DefaultParser();
    Options options = new Options();
    options.addOption("a", "abc", true, "First Parameter");
    options.addOption("x", "xyz", true, "Second Parameter");
    options.addOption("h", "help", false, "Shows this Help");
    try {
      CommandLine commandLine = parser.parse(options, args);
      System.out.println(commandLine.getOptionValue("a"));
      System.out.println(commandLine.getOptionValue("x"));
      if (commandLine.hasOption("h")) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("CommandLineParameters", options);
      }
    } catch (ParseException e) {
      e.printStackTrace();
    }
  }
}
In Eclipse I can run this by modifying the Arguments passed to the Run Configurations..., however, what I would in fact like to do is, to be able to run this programme from a terminal shell, in an analogous way to "normal" terminal programmes such as grep, or ipconfig. 
How can this be achieved using Java?
NOTE: I'm not trying to compile/build this programme from the command line, I'm trying to make an interface to the program in the command line.





javaandjavawand they're described on the documentation page.