code: private void setWorkingDir(String[] args) throws FileNotFoundException {
      String workDir = null;
      // skip first node type argument (locator/server/lead)
      for (int i = 1; i < args.length; i++) {
        String arg = args[i];
        if (arg.startsWith(DIR_OPT)) {
          workDir = arg.substring(DIR_OPT.length());
        } else if (!arg.equalsIgnoreCase("stop") &&
            !arg.equalsIgnoreCase("status") &&
            !arg.equalsIgnoreCase("wait") &&
            !arg.equalsIgnoreCase("verbose")) {
          throw new IllegalArgumentException(
              MessageFormat.format(LAUNCHER_UNKNOWN_ARGUMENT, arg));
        }
      }
      processDirOption(workDir);
    }
docs: Extracts working directory configuration from command-line arguments
  for stop/status/wait/verbose commands.