Command line runnability: checks for [-out outFilename] arg.
<p>Command line entrypoint; Sets output and calls
{@link #checkEnvironment(PrintWriter)}.</p>
@param args command line args
359794
public static void main(String[] args)
  {
    // Default to System.out, autoflushing
    PrintWriter sendOutputTo = new PrintWriter(System.out, true);

    // Read our simplistic input args, if supplied
    for (int i = 0; i < args.length; i++)
    {
      if ("-out".equalsIgnoreCase(args[i]))
      {
        i++;

        if (i < args.length)
        {
          try
          {
            sendOutputTo = new PrintWriter(new FileWriter(args[i], true));
          }
          catch (Exception e)
          {
            System.err.println("# WARNING: -out " + args[i] + " threw "
                               + e.toString());
          }
        }
        else
        {
          System.err.println(
            "# WARNING: -out argument should have a filename, output sent to console");
        }
      }
    }

    EnvironmentCheck app = new EnvironmentCheck();
    app.checkEnvironment(sendOutputTo);
  }
730544
public int run(String[] args) throws Exception {
    int exitCode = 0;
    exitCode = init(args);
    if (exitCode != 0) {
      return exitCode;
    }
    genDirStructure();
    output(new File(outDir, DIR_STRUCTURE_FILE_NAME));
    genFileStructure();
    outputFiles(new File(outDir, FILE_STRUCTURE_FILE_NAME));
    return exitCode;
  }
243019
public static void main(String[] args) throws Exception {
      Shell shell = new ShellImpl();
      shell.init(args);
      shell.run();
      System.exit(0);
   }
885933
public static void main(String[] args) {
        String modelFile = "";
        String outputFile = "";
        int numberOfRows = 0;
        try {
            modelFile = args[0];
            outputFile = args[1];
            numberOfRows = Integer.valueOf(args[2]);
        } catch (IndexOutOfBoundsException | NumberFormatException e) {
            System.out.println("ERROR! Invalid command line arguments, expecting: <scxml model file> "
                    + "<desired csv output file> <desired number of output rows>");
            return;
        }

        FileInputStream model = null;
        try {
            model = new FileInputStream(modelFile);
        } catch (FileNotFoundException e) {
            System.out.println("ERROR! Model file not found");
            return;
        }

        SCXMLEngine engine = new SCXMLEngine();
        engine.setModelByInputFileStream(model);
        engine.setBootstrapMin(5);

        DataConsumer consumer = new DataConsumer();
        CSVFileWriter writer;
        try {
            writer = new CSVFileWriter(outputFile);
        } catch (IOException e) {
            System.out.println("ERROR! Can not write to output csv file");
            return;
        }
        consumer.addDataWriter(writer);

        DefaultDistributor dist = new DefaultDistributor();
        dist.setThreadCount(5);
        dist.setMaxNumberOfLines(numberOfRows);
        dist.setDataConsumer(consumer);

        engine.process(dist);
        writer.closeCSVFile();

        System.out.println("COMPLETE!");
    }
861635
public void run(String[] args) {
		System.out.println("SampleStarter.run(String[])");
		System.out.println("- args.length: " + args.length);
		for (String arg : args) System.out.println("  - " + arg);
		System.out.println(this);
	}
1309754
public static void main(String[] args) {
    try {
      ToolRunner.run(new JobFilePartitioner(), args);
    } catch (Exception e) {
      LOG.error("Problem running: " + NAME, e);
    }
  }
648863
public static void main(String[] args) {
    try {
      ToolRunner.run(new ProcessingRecordsPrinter(), args);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
1318238
public void run(String... args) throws BadArgs, IOException {
        PrintWriter out = new PrintWriter(System.out);
        try {
            run(out, args);
        } finally {
            out.flush();
        }
    }
176675
public void runArgs(String[] args) {
        CommandLineParser clParser = new DefaultParser();
        CommandLine line;
        String host;
        String port;
        CMD cmd;
        String[] cmdArgs;
        final PrintStream CONSOLE = System.out;
        try {
            // parse the command line arguments
            line = clParser.parse(options, args);

            if (line.hasOption("output")){
                String location = line.getOptionValue("output");
                File output = new File(location);
                FileOutputStream fos;
                try {
                    fos = new FileOutputStream(output);
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                    throw new ParseException(String.format("Wrong -o option. args %s\n",Arrays.asList(args)));
                }
                PrintStream out = new PrintStream(fos);
                System.setOut(out);

            }
            if (line.getOptions().length==0 || line.hasOption("help")) {
                if ((line.getOptions().length > 2) || (line.getOptions().length==2 && !line.hasOption("output"))){
                    throw new ParseException(String.format("Wrong -help option. args %s\n", Arrays.asList(args)));
                }
                printUsage(System.out);
            }
            if (line.hasOption("server")) {
                String server = line.getOptionValue("server");
                try {
                    host = server.split(":")[0];
                    port = server.split(":")[1];
                }catch (Exception e){
                    throw new ParseException(String.format("Wrong -server option. args %s\n", Arrays.asList(args)));
                }
                ServiceDirectory.getServiceDirectoryConfig().setProperty(
                        DirectoryServiceRestfulClient.SD_API_SD_SERVER_FQDN_PROPERTY,
                        host);
                ServiceDirectory.getServiceDirectoryConfig().setProperty(
                        DirectoryServiceRestfulClient.SD_API_SD_SERVER_PORT_PROPERTY,
                        port);
            }

            if (line.hasOption("exec")) {
                String commandString = line.getOptionValue("exec");
                cmdArgs = parseCommand(commandString);
                try {
                    cmd = CMD.valueOf(cmdArgs[0]);
                } catch (IllegalArgumentException e) {
                    throw new ParseException(String.format("Unknown command [ %s ] \n", commandString));
                }
                if (cmd.sizeOfArgs + 1 != cmdArgs.length) {
                    throw new ParseException(
                            String.format("Wrong arguments number for command %s, required %s but %s \n",
                                    cmdArgs[0], cmd.sizeOfArgs, cmdArgs.length - 1));
                }
                switch (cmd) {
                    case getInstanceOf:
                        lookupInstance(cmdArgs);
                        break;
                    case getAllInstancesOf:
                        lookupInstances(cmdArgs);
                        break;
                    case getAllServices:
                        getAllServices();
                        break;
                    case registerService:
                        registerService(cmdArgs);
                        break;
                    default:
                        fail("command " + cmd + " is unsupported yet");
                        break;
                }

            }
        } catch (ParseException exp) {
            // oops, something went wrong
            exp.printStackTrace();
            try {
                TimeUnit.MILLISECONDS.sleep(100L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            printUsage(System.err);
        }
        System.setOut(CONSOLE);
    }
488100
public void run(String... args) {
        int maxIteration = 10;
        int totalMoreFast = 0;
        int totalMoreFastWithThreadPool = 0;
        int totalMoreFastPacketThreadPool = 0;
        for (int i = 0; i < maxIteration; i++) {
            LOGGER.info("**********************************");
            long jxnetRunnerRes = jxnetRunner.run();
            long jxnetWithThreadPoolRunnerRes = jxnetWithThreadPoolRunner.run();
            long jxnetPacketThreadPoolRunnerRes = springJxnetWithThreadPoolRunner.run();
            long pcap4jRunnerRes = pcap4jRunner.run();
            long pcap4jWithThreadPoolRunnerRes = pcap4jWithThreadPoolRunner.run();
            long pcap4jPacketThreadPoolRunnerRes = pcap4jPacketWithThreadPoolRunner.run();
            LOGGER.info("Jxnet x Pcap4j");
            boolean moreFast = jxnetRunnerRes < pcap4jRunnerRes;
            boolean moreFastWithThreadPool = jxnetWithThreadPoolRunnerRes < pcap4jWithThreadPoolRunnerRes;
            boolean moreFastPacketThreadPool = jxnetPacketThreadPoolRunnerRes < pcap4jPacketThreadPoolRunnerRes;
            if (moreFast) {
                totalMoreFast++;
            }
            if (moreFastWithThreadPool) {
                totalMoreFastWithThreadPool++;
            }
            if (moreFastPacketThreadPool) {
                totalMoreFastPacketThreadPool++;
            }
            LOGGER.info("Is Jxnet runner more fast? {} : {}",
                     moreFast ? "YES" : "NO",
                    jxnetRunnerRes + " and " + pcap4jRunnerRes);
            LOGGER.info("Is Jxnet with thread pool runner more fast? {} : {}",
                    moreFastWithThreadPool ? "YES" : "NO",
                    jxnetWithThreadPoolRunnerRes + " and " + pcap4jWithThreadPoolRunnerRes);
            LOGGER.info("IS Jxnet packet with thread pool runner more fast? {} : {}",
                    moreFastPacketThreadPool ? "YES" : "NO",
                    jxnetPacketThreadPoolRunnerRes + " and " + pcap4jPacketThreadPoolRunnerRes);
            LOGGER.info("**********************************\n");
        }
        LOGGER.info("Total jxnet more fast                                 : {}/{}", totalMoreFast, maxIteration);
        LOGGER.info("Total jxnet more fast with thread pool                : {}/{}", totalMoreFastWithThreadPool, maxIteration);
        LOGGER.info("Total jxnet more fast packet decoder with thread pool : {}/{}", totalMoreFastPacketThreadPool, maxIteration);
        executorService.shutdownNow();
    }
406300
public static void main(final String[] args) {
        Switch about = new Switch("a", "about", "display about message");
        Switch help = new Switch("h", "help", "display help message");

        FileArgument expectedFile = new FileArgument("e", "expected-file", "expected interpretation file, default stdin; at least one of expected or observed file must be provided", false);
        FileArgument observedFile = new FileArgument("b", "observed-file", "observed interpretation file, default stdin; at least one of expected or observed file must be provided", false);
        FileArgument outputFile = new FileArgument("o", "output-file", "output file, default stdout", false);
        IntegerArgument resolution = new IntegerArgument("r", "resolution", "resolution, must be in the range [1..4], default " + DEFAULT_RESOLUTION, false);
        StringListArgument loci = new StringListArgument("l", "loci", "list of loci to validate, default " + DEFAULT_LOCI, false);
        Switch printSummary = new Switch("s", "summary", "print summary");

        ArgumentList arguments = new ArgumentList(about, help, expectedFile, observedFile, outputFile, resolution, loci, printSummary);
        CommandLine commandLine = new CommandLine(args);

        ValidateInterpretation validateInterpretation = null;
        try
        {
            CommandLineParser.parse(commandLine, arguments);
            if (about.wasFound()) {
                About.about(System.out);
                System.exit(0);
            }
            if (help.wasFound()) {
                Usage.usage(USAGE, null, commandLine, arguments, System.out);
                System.exit(0);
            }

            // todo: allow for configuration of glclient
            validateInterpretation = new ValidateInterpretation(expectedFile.getValue(), observedFile.getValue(), outputFile.getValue(), resolution.getValue(DEFAULT_RESOLUTION), loci.getValue(DEFAULT_LOCI), printSummary.wasFound(), LocalGlClient.create());
        }
        catch (CommandLineParseException e) {
            if (about.wasFound()) {
                About.about(System.out);
                System.exit(0);
            }
            if (help.wasFound()) {
                Usage.usage(USAGE, null, commandLine, arguments, System.out);
                System.exit(0);
            }
            Usage.usage(USAGE, e, commandLine, arguments, System.err);
            System.exit(-1);
        }
        try {
            System.exit(validateInterpretation.call());
        }
        catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }
1103833
public static void main(String[] args) {

		showTitle("JRE Properties"); //$NON-NLS-1$

		showPropertyValue("java.class.path"); //$NON-NLS-1$
		showPropertyValue("java.library.path"); //$NON-NLS-1$
		showPropertyValue("java.home"); //$NON-NLS-1$
		showPropertyValue("os.name"); //$NON-NLS-1$
		showPropertyValue("os.version"); //$NON-NLS-1$
		showPropertyValue("file.separator"); //$NON-NLS-1$
		showPropertyValue("path.separator"); //$NON-NLS-1$
		showPropertyValue("sun.arch.data.model"); //$NON-NLS-1$
		showPropertyValue("user.dir"); //$NON-NLS-1$
		showPropertyValue("user.name"); //$NON-NLS-1$
		showPropertyValue("user.home"); //$NON-NLS-1$

		showTitle("FileSystem"); //$NON-NLS-1$

		showValue("getUserHomeDirectoryName()", FileSystem.getUserHomeDirectoryName()); //$NON-NLS-1$
		try {
			showValue("getUserHomeDirectory()", FileSystem.getUserHomeDirectory()); //$NON-NLS-1$
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}

		showTitle("OperatingSystem"); //$NON-NLS-1$

		showValue("getCurrentOSName()", OperatingSystem.getCurrentOSName()); //$NON-NLS-1$
		showValue("getCurrentOSVersion()", OperatingSystem.getCurrentOSVersion()); //$NON-NLS-1$
		showValue("getOSSerialNumber()", OperatingSystem.getOSSerialNumber()); //$NON-NLS-1$
		showValue("getOSUUID()", OperatingSystem.getOSUUID()); //$NON-NLS-1$
		showValue("getIdentificationType()", OperatingSystem.getIdentificationType().name()); //$NON-NLS-1$
		showValue("getOperatingSystemArchitectureDataModel()", //$NON-NLS-1$
				Integer.toString(OperatingSystem.getOperatingSystemArchitectureDataModel()));
		showValue("getCurrentOS()", OperatingSystem.getCurrentOS().name()); //$NON-NLS-1$
		showValue("is32BitOperatingSystem()", Boolean.toString(OperatingSystem.is32BitOperatingSystem())); //$NON-NLS-1$
		showValue("is64BitOperatingSystem()", Boolean.toString(OperatingSystem.is64BitOperatingSystem())); //$NON-NLS-1$
	}
476490
public static void main(String[] args) throws IOException, ConfigurableException, ClassNotFoundException {
        // initialize property file
        String configFileName = null;
        ArrayList<String> cleanArgs = new ArrayList<String>();
        for (String arg : args) {
            if (arg.startsWith(configFileCmdLineKey)) {
                configFileName = arg.substring(configFileCmdLineKey.length());
            } else {
                cleanArgs.add(arg);
            }
        }

       
        args = cleanArgs.toArray(new String[cleanArgs.size()]);
        cleanArgs.clear();

        // collect properties specified on the command line
        Properties commandProperties = new Properties();
        for (String arg : args) {
            if (arg.startsWith(propCmdLineKey)) {
                String[] props = arg.substring(propCmdLineKey.length()).split("=");
                if (0 < props.length) {
                    String key = props[0];
                    String value = "";
                    if (1 < props.length) {
                        value = props[1];
                    }
                    commandProperties.put(key, value);
                }
            } else {
                cleanArgs.add(arg);
            }
        }

        args = cleanArgs.toArray(new String[cleanArgs.size()]);

        // check input parameters
        if (args.length < 1) {
            System.out.println(USAGE);
        } else {
            MatchManager mm = new MatchManager();

            Properties config = new Properties();
            if (configFileName == null) {
                config.load(Thread.currentThread().getContextClassLoader().getResource(DEFAULT_CONFIG_FILE_NAME).openStream());
            } else {
                config.load(new FileInputStream(configFileName));
            }

            if (log.isEnabledFor(Level.DEBUG)) {
                for (String k : commandProperties.stringPropertyNames()) {
                    log.debug("property override: " + k + "=" + commandProperties.getProperty(k));
                }
            }

            // override from command line
            config.putAll(commandProperties);

            mm.setProperties(config);

            if ("wntoflat".equals(args[0])) {
                mm.convertWordNetToFlat(config);
            } else if ("convert".equals(args[0])) {
                if (2 < args.length) {
                    if (3 == args.length) {
                        String inputFile = args[1];
                        String outputFile = args[2];
                        IBaseContext ctxSource = mm.loadContext(inputFile);
                        mm.renderContext(ctxSource, outputFile);
                    } else if (5 == args.length) {
                        String sourceFile = args[1];
                        String targetFile = args[2];
                        String inputFile = args[3];
                        String outputFile = args[4];

                        if (mm.getContextLoader() instanceof IContextLoader) {
                            IContext ctxSource = (IContext) mm.loadContext(sourceFile);
                            IContext ctxTarget = (IContext) mm.loadContext(targetFile);
                            IContextMapping<INode> map = mm.loadMapping(ctxSource, ctxTarget, inputFile);
                            mm.renderMapping(map, outputFile);
                        } else {
                            System.out.println("To convert a mapping, use context loaders supporting IContextLoader.");
                        }
                    }
                } else {
                    System.out.println("Not enough arguments for convert command.");
                }
            } else if ("offline".equals(args[0])) {
                if (2 < args.length) {
                    String inputFile = args[1];
                    String outputFile = args[2];
                    if (mm.getContextLoader() instanceof IContextLoader && mm.getContextRenderer() instanceof IContextRenderer) {
                        IContext ctxSource = (IContext) mm.loadContext(inputFile);
                        mm.offline(ctxSource);
                        mm.renderContext(ctxSource, outputFile);
                    } else {
                        System.out.println("To preprocess a mapping, use context loaders and renderers support IContextLoader and IContextRenderer.");
                    }
                } else {
                    System.out.println("Not enough arguments for offline command.");
                }
            } else if ("online".equals(args[0])) {
                if (3 < args.length) {
                    String sourceFile = args[1];
                    String targetFile = args[2];
                    String outputFile = args[3];
                    if (mm.getContextLoader() instanceof IContextLoader) {
                        IContext ctxSource = (IContext) mm.loadContext(sourceFile);
                        IContext ctxTarget = (IContext) mm.loadContext(targetFile);
                        IContextMapping<INode> result = mm.online(ctxSource, ctxTarget);
                        mm.renderMapping(result, outputFile);
                    } else {
                        System.out.println("To match contexts, use context loaders supporting IContextLoader.");
                    }
                } else {
                    System.out.println("Not enough arguments for online command.");
                }
            } else if ("filter".equals(args[0])) {
                if (4 < args.length) {
                    String sourceFile = args[1];
                    String targetFile = args[2];
                    String inputFile = args[3];
                    String outputFile = args[4];

                    if (mm.getContextLoader() instanceof IContextLoader) {
                        IContext ctxSource = (IContext) mm.loadContext(sourceFile);
                        IContext ctxTarget = (IContext) mm.loadContext(targetFile);
                        IContextMapping<INode> mapInput = mm.loadMapping(ctxSource, ctxTarget, inputFile);
                        IContextMapping<INode> mapOutput = mm.filterMapping(mapInput);
                        mm.renderMapping(mapOutput, outputFile);
                    } else {
                        System.out.println("To filter a mapping, use context loaders supporting IContextLoader.");
                    }
                } else {
                    System.out.println("Not enough arguments for mappingFilter command.");
                }
            } else {
                System.out.println("Unrecognized command.");
            }
        }
    }
884421
public static int run(String[] args, PrintWriter out) {
        JdepsTask t = new JdepsTask();
        t.setLog(out);
        return t.run(args);
    }
806347
public static void main(final String[] args) {
        String propertyFile = System.getProperty("file");
        if (propertyFile == null) {
            System.out.println("Property file not given, exiting.");
            System.exit(0);
        }
        final Properties properties = new Properties();
        try {
            properties.load(new FileInputStream(propertyFile));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException ie) {
            ie.printStackTrace();
        }
        recommend(properties);
    }
356524
public static void main(String[] args) {
		if (args.length > 0) {
			System.out.printf("%s\n", getFullVersion());
		} else {
			System.out.println(VERSION);
		}
	}
398406
public static void main(String[] args) {
        int exitCode = 0;
        final App app = new App();
        exitCode = app.run(args);
        LOGGER.debug("Exit code: {}", exitCode);
        System.exit(exitCode);
    }