public static void main(String[] args) throws Exception {
    String[] newArgs = args;
    if (!hasServer(args)) {
      // Add the zk ensemble from configuration if none passed on command-line.
      Configuration conf = HBaseConfiguration.create();
      String hostport = new ZKMainServer().parse(conf);
      if (hostport != null && hostport.length() > 0) {
        newArgs = new String[args.length + 2];
        System.arraycopy(args, 0, newArgs, 2, args.length);
        newArgs[0] = "-server";
        newArgs[1] = hostport;
      }
    }
    // If command-line arguments, run our hack so they are executed.
    // ZOOKEEPER-1897 was committed to zookeeper-3.4.6 but elsewhere in this class we say
    // 3.4.6 breaks command-processing; TODO.
    if (hasCommandLineArguments(args)) {
      try (HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain zkm =
        new HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain(newArgs)) {
        zkm.runCmdLine();
      }
    } else {
      ZooKeeperMain.main(newArgs);
    }
  }
Run the tool.
@param args Command line arguments. First arg is path to zookeepers file.
hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKMainServer.java