public static int mainInt(String... args) throws Exception {
        if (args.length != 5 && args.length != 4) {
          throw new IllegalAccessException("Usage: HTMLLauncher outputDir testSuite startUrl multiWindow browser");
        }

        File dir = new File(args[0]);
        if (!dir.exists() && !dir.mkdirs()) {
          throw new RuntimeException("Cannot create output directory for: " + dir);
        }

        String suite = args[1];
        String startURL = args[2];
        boolean multiWindow = Boolean.parseBoolean(args[3]);
        String[] browsers;
        if (args.length == 4) {
          log.info("Running self tests");
          browsers = new String[] { "firefox", "iexploreproxy", "opera", "chrome" };
        } else {
          browsers = new String[] { args[4] };
        }

        SeleniumServer server = new SeleniumServer(false, new RemoteControlConfiguration());
        server.start();
        HTMLLauncher launcher = new HTMLLauncher(server);

        boolean passed = true;
        for (String browser : browsers) {
          // Turns out that Windows doesn't like "*" in a path name
          File results = new File(dir, browser.substring(1) + ".results");
          String result = "FAILED";

          try {
            result = launcher.runHTMLSuite(browser, startURL, suite, results, 600, multiWindow);
            passed &= "PASSED".equals(result);
          } catch (Throwable e) {
            log.warn("Test of browser failed: " + browser, e);
            passed = false;
          }
        }
        server.stop();

        return passed ? 1 : 0;
    }