Entry point for the agent, using command line attach
(that is via -javaagent command line argument)

@param agentArgs arguments as given on the command line
329432
public static void premain(String agentArgs, Instrumentation inst) {
        startAgent(new JvmAgentConfig(agentArgs), true /* register and detect lazy */, inst);
    }
1043073
public static void main(String[] args) {
    validateArguments(args);

    EchoClient echoClient = newEchoClient(lenientParsePort(args[0]));

    for (int index = 1; index < args.length; index++) {
      System.out.println(echoClient.sendMessage(args[index]));
    }
  }
500725
public static void main(final String[] args) throws IOException, InjectionException {
    final ClientProtocol.DriverClientConfiguration driverClientConfigurationProto;
    if (args.length > 0) {
      final String content = new String(Files.readAllBytes(Paths.get(args[0])));
      final ClientProtocol.DriverClientConfiguration.Builder driverClientConfigurationProtoBuilder =
          ClientProtocol.DriverClientConfiguration.newBuilder();
      JsonFormat.parser()
          .usingTypeRegistry(JsonFormat.TypeRegistry.getEmptyTypeRegistry())
          .merge(content, driverClientConfigurationProtoBuilder);
      driverClientConfigurationProto = driverClientConfigurationProtoBuilder.build();
      final int port = (args.length == 2) ? Integer.parseInt(args[1]) : 0;
      final LauncherStatus status = submit(port, driverClientConfigurationProto);
      LOG.log(Level.INFO, "Status: {0}", status);
    } else {
      LOG.log(Level.SEVERE, ClientLauncher.class.getName() +
          " accepts single required argument referencing a file that contains a " +
          "client protocol buffer driver configuration");
      System.exit(1);
    }
  }
682875
public void setArgs(java.util.Collection<CodeGenNodeArg> args) {
        if (args == null) {
            this.args = null;
            return;
        }

        this.args = new java.util.ArrayList<CodeGenNodeArg>(args);
    }
123389
@Override
    public void loadAgentLibrary(String agentLibrary, String options)
        throws AgentLoadException, AgentInitializationException, IOException
    {
        loadAgentLibrary(agentLibrary, false, options);
    }
242347
public static void initApplication(String... args) {
		if (args.length < 1) {
			System.err.println("Please specify an Application as argument");
			System.exit(-1);
		}
		setInstance(createApplicationByClassName(args[0]));
	}
38688
public static void agentmain(final String options,
			final Instrumentation instrumentation) throws Exception {
		logger.info("Sigar loader via agent-main.");
		configure(options, instrumentation);
	}
437305
public static void main(final String[] args) {
        /*-
         * use one of the pre-defined amis
         * (all amis are pre-defined in aws-mock-default.properties or aws-mock.properties)
         */
        String imageId = "ami-12345678";
        final int runCount = 10;

        List<Instance> startedInstances = runInstances(imageId, runCount);

        System.out.println("Started instances: ");

        for (Instance i : startedInstances) {
            System.out.println(i.getInstanceId() + " - " + i.getState().getName());
        }
    }
1017917
public static void main(String[] args) {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            javax.swing.SwingUtilities.invokeLater(new Runnable() {

                @Override
                public void run() {
                    if (args.length != 0) {
                        //System.out.println("OK");
                        TaskManagerTabPanel panel = new TaskManagerTabPanel();
                        panel.runTaskCLI(args);
                        System.exit(0);

                    } else {
                        createAndShowGUI();
                    }
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
841608
public void createAgent(String agent_name, String path) {
        IComponentIdentifier agent = cmsService.createComponent(agent_name,
                path, null, null).get(new ThreadSuspendable());
        createdAgents.put(agent_name, agent);
    }
390030
public static void main(String[] args) {
        try {
            ParsedCommandLine pcl = new ParsedCommandLine(args);
            Callable<String> command = pcl.getCommand();
            if (command == null) {
                System.out.println(pcl.getHelpText());
            } else {
                System.out.println(command.call());
            }
        } catch (Exception ex) {
            System.err.println("ERROR: " + ex.getMessage());
        }
    }
1095673
public void startAgent (AgentObject agent)
    {
        agent.setLocal(AgentData.class, new AgentData());

        Bureau bureau = _bureaus.get(agent.bureauId);
        if (bureau != null && bureau.ready()) {
            _omgr.registerObject(agent);

            log.info("Bureau ready, sending createAgent", "agent", agent.which());
            BureauSender.createAgent(bureau.clientObj, agent.getOid());
            bureau.agentStates.put(agent, AgentState.STARTED);
            bureau.summarize();
            return;
        }

        if (bureau == null) {
            LauncherEntry launcherEntry = _launchers.get(agent.bureauType);
            if (launcherEntry == null) {
                log.warning("Launcher not found", "agent", agent.which());
                return;
            }

            log.info("Creating new bureau", "bureauId", agent.bureauId, "launcher", launcherEntry);
            bureau = new Bureau();
            bureau.bureauId = agent.bureauId;
            bureau.token = generateToken(bureau.bureauId);
            bureau.launcherEntry = launcherEntry;
            _invoker.postUnit(new LauncherUnit(bureau, _omgr));
            _bureaus.put(agent.bureauId, bureau);
        }

        _omgr.registerObject(agent);
        bureau.agentStates.put(agent, AgentState.PENDING);

        log.info("Bureau not ready, pending agent", "agent", agent.which());
        bureau.summarize();
    }
673068
public static void main(final String[] args) throws InjectionException, IOException {

    final ClientProtocol.DriverClientConfiguration.Builder builder =
        ClientProtocol.DriverClientConfiguration.newBuilder();
    builder.setJobid("HelloREEF");
    builder.setEnableHttpDriver(false);
    builder.setOperatingSystem(ClientProtocol.DriverClientConfiguration.OS.LINUX);
    builder.setAzbatchRuntime(ClientProtocol.AzureBatchRuntimeParameters.newBuilder()
        .build());
    builder.addGlobalLibraries(EnvironmentUtils.getClassLocation(HelloDriver.class));

    JavaClientLauncher.submit(builder.build(), DRIVER_CONFIG);
    LOG.log(Level.INFO, "REEF job completed");
    ThreadLogger.logThreads(LOG, Level.FINE, "Threads running at the end of HelloREEF:");
  }
99331
public static void main(final String[] args) throws InjectionException, IOException {

    final JavaConfigurationBuilder driverConfigBuilder = TANG.newConfigurationBuilder(STATIC_DRIVER_CONFIG);

    new CommandLine(driverConfigBuilder)
        .registerShortNameOfClass(Command.class)
        .registerShortNameOfClass(NumEvaluators.class)
        .registerShortNameOfClass(RuntimeName.class)
        .processCommandLine(args);

    final Configuration driverConfig = driverConfigBuilder.build();

    final Injector injector = TANG.newInjector(driverConfig);

    final int numEvaluators = injector.getNamedInstance(NumEvaluators.class);
    final String runtimeName = injector.getNamedInstance(RuntimeName.class);
    final String command = injector.getNamedInstance(Command.class);

    LOG.log(Level.INFO, "REEF distributed shell: {0} evaluators on {1} runtime :: {2}",
        new Object[] {numEvaluators, runtimeName, command});

    final Configuration runtimeConfig;

    switch (runtimeName) {
    case "local":
      runtimeConfig = LocalRuntimeConfiguration.CONF
          .set(LocalRuntimeConfiguration.MAX_NUMBER_OF_EVALUATORS, numEvaluators)
          .build();
      break;
    case "yarn":
      runtimeConfig = YarnClientConfiguration.CONF.build();
      break;
    default:
      LOG.log(Level.SEVERE, "Unknown runtime: {0}", runtimeName);
      throw new IllegalArgumentException("Unknown runtime: " + runtimeName);
    }

    final LauncherStatus status = DriverLauncher.getLauncher(runtimeConfig).run(driverConfig, JOB_TIMEOUT);

    LOG.log(Level.INFO, "REEF job completed: {0}", status);
  }
253452
public static void main(final String[] args) {
		EnvironmentInformation.logEnvironmentInfo(LOG, "Command Line Client", args);

		// 1. find the configuration directory
		final String configurationDirectory = getConfigurationDirectoryFromEnv();

		// 2. load the global configuration
		final Configuration configuration = GlobalConfiguration.loadConfiguration(configurationDirectory);

		// 3. load the custom command lines
		final List<CustomCommandLine<?>> customCommandLines = loadCustomCommandLines(
			configuration,
			configurationDirectory);

		try {
			final CliFrontend cli = new CliFrontend(
				configuration,
				customCommandLines);

			SecurityUtils.install(new SecurityConfiguration(cli.configuration));
			int retCode = SecurityUtils.getInstalledContext()
					.runSecured(() -> cli.parseParameters(args));
			System.exit(retCode);
		}
		catch (Throwable t) {
			final Throwable strippedThrowable = ExceptionUtils.stripException(t, UndeclaredThrowableException.class);
			LOG.error("Fatal error while running command line interface.", strippedThrowable);
			strippedThrowable.printStackTrace();
			System.exit(31);
		}
	}
77073
public static void agentmain(String options, Instrumentation instrumentation) {
        if (Config.X_ENABLED_V) {
            init(instrumentation);
            instrumentation.addTransformer(new MavenCFT(), true);
            instrumentMaven(instrumentation);
        }
    }
708395
public void processArguments(String[] args) throws IOException {
        List<File> classFiles = new ArrayList<File>();
        List<File> jarFiles = new ArrayList<File>();
        String[] fileArgs = null;

        for (int i = 0; i < args.length; i++) {
            if (args[i].equalsIgnoreCase("--config")) {
                configFileParser = new TraceConfigFileParser(new File(args[++i]));
                configFileParser.parse();
                InstrumentationOptions options = configFileParser.getInstrumentationOptions();
                if (options.getAddFFDC()) {
                    setInstrumentWithFFDC(true);
                }
                setTraceType(options.getTraceType());
                setInstrumentationOptions(options);
            } else if (args[i].equalsIgnoreCase("--debug") || args[i].equals("-d")) {
                setDebug(true);
            } else if (args[i].equalsIgnoreCase("--tr")) {
                setTraceType(TraceType.TR);
            } else if (args[i].equalsIgnoreCase("--websphere")) {
                setTraceType(TraceType.TR);
            } else if (args[i].equalsIgnoreCase("--java-logging")) {
                setTraceType(TraceType.JAVA_LOGGING);
            } else if (args[i].equalsIgnoreCase("--jsr47")) {
                setTraceType(TraceType.JAVA_LOGGING);
            } else if (args[i].equalsIgnoreCase("--none")) {
                setTraceType(TraceType.NONE);
            } else if (args[i].equalsIgnoreCase("--no-trace")) {
                setTraceType(TraceType.NONE);
            } else if (args[i].equalsIgnoreCase("--ffdc")) {
                setInstrumentWithFFDC(true);
            } else if (args[i].equalsIgnoreCase("--compute-frames")) {
                setComputeFrames(true);
            } else {
                fileArgs = new String[args.length - i];
                System.arraycopy(args, i, fileArgs, 0, fileArgs.length);
                break;
            }
        }

        if (fileArgs == null || fileArgs.length == 0) {
            throw new IllegalArgumentException("Empty file lists are illegal");
        }

        for (int i = 0; i < fileArgs.length; i++) {
            File f = new File(fileArgs[i]);
            if (!f.exists()) {
                throw new IllegalArgumentException(f + " does not exist");
            } else if (f.isDirectory()) {
                classFiles.addAll(getClassFiles(f, null));
            } else if (f.getName().endsWith(".class")) {
                classFiles.add(f);
            } else if (f.getName().endsWith(".jar")) {
                jarFiles.add(f);
            } else if (f.getName().endsWith(".zip")) {
                jarFiles.add(f);
            } else {
                System.err.println(f + " is an unexpected file type; ignoring");
            }
        }

        setClassFiles(classFiles);
        setJarFiles(jarFiles);
    }