protected void doStaticMain(String args[]) {
    int ret;
    try {
      ret = ToolRunner.run(HBaseConfiguration.create(), this, args);
    } catch (Exception ex) {
      LOG.error("Error running command-line tool", ex);
      ret = EXIT_FAILURE;
    }
    System.exit(ret);
  }
Call this from the concrete tool class's main function.
hbase-common/src/main/java/org/apache/hadoop/hbase/util/AbstractHBaseTool.java