public static void main(String[] args) throws Throwable {
        @Parameters(separators = "=", optionPrefixes = "")
        class CLIParameters {
            @Parameter(names = {"--host", "-h"}, arity = 1,
                       description = "Hostname or IP Address, Jetty will be bounded to (default localhost)")
            private String host = "localhost";
            @Parameter(names = {"--port", "-p"}, arity = 1,
                       description = "Port, Jetty will listen to (default 8080)")
            private Integer port = 8080;
            @Parameter(names = {"--monitoringPort", "-m"}, arity = 1,
                       description = "Monitoring port (default 8888, -1 turns it of)")
            private Integer monitoringPort = 8888;
            @Parameter(names = {"--config", "-c"}, arity = 1,
                       description = "Custom jetty.xml")
            private File config;
            @Parameter(names = {"--browser", "-b"}, arity = 1,
                       description = "Start browser (default false)")
            private boolean startBrowser;
            @Parameter(names = {"--browserURL", "-u"}, arity = 1,
                    description = "URL to open (applies only if --browser option is on) " +
                                  "(default http://<host>:<port>/<application.context>)")
            private String browserUrl;
            @Parameter(description = "Target <start|stop|status>", required = true)
            private List<String> mode;
        }
        CLIParameters parameters = new CLIParameters();
        JCommander commander = new JCommander(parameters);
        try {
            commander.parse(args);
            if (parameters.mode == null || parameters.mode.size() != 1 ||
                !Arrays.asList("start", "stop", "status").contains(parameters.mode.get(0))) {
                throw new ParameterException("Target is invalid.");
            }
        } catch (ParameterException e) {
            System.err.println("Error: " + e.getMessage());
            commander.usage();
            System.exit(1);
        }
        String mode = parameters.mode.get(0);
        EmbeddedServerConfig configuration = new EmbeddedServerConfig(parameters.host, parameters.port, parameters.config);
        if ("start".equals(mode)) {
            startServer(configuration, parameters.monitoringPort);
            if (parameters.startBrowser) {
                String url = parameters.browserUrl;
                if (url == null) {
                    String context = JWarPackBundle.get(APPLICATION_CONTEXT, "/");
                    url = String.format("http://%s:%s%s", configuration.getHost(), configuration.getPort(), context);
                }
                BrowserLauncher.open(url);
            }
        } else {
            MonitoringServer monitoringServer = new MonitoringServer();
            monitoringServer.setPort(parameters.monitoringPort);
            if ("stop".equalsIgnoreCase(mode)) {
                monitoringServer.sendShutdownRequest();
            } else 
            if ("status".equalsIgnoreCase(mode)) {
                monitoringServer.sendStatusRequest();
            }
        }
    }