public static void main()

in java-local/src/main/java/openwhisk/java/local/CLI.java [56:93]


  public static void main(String[] args) {

    CLI cli = new CLI();
    try {
      CommandLine.populateCommand(cli, args);

      Path path = Paths.get(cli.binary).toRealPath();
      final boolean isJar = path.toString().endsWith(".jar");
      final boolean isJava = path.toString().endsWith(".java");
      if (!isJava && !isJar) {
        System.out.printf("%s is not a jar or java file\n", cli.binary);
        CommandLine.usage(cli, System.out);
        return;
      }

      File f = path.toFile();
      if (!f.canRead()) {
        System.out.printf("%s does not exist or can not be read\n", cli.binary);
        return;
      }

      Launcher launcher = new Launcher();
      launcher.setBinaryPath(path);
      launcher.setEntryClassName(cli.mainClassName);
      launcher.setParameter(readParameters(cli));
      JsonObject o = launcher.launch();
      Gson gson = new Gson();
      System.out.println(gson.toJson(o));
      System.exit(0);

    } catch (ParameterException e) {
      System.out.println(e.getMessage());
      CommandLine.usage(cli, System.out);
    } catch (Exception e) {
      e.printStackTrace();
    }

  }