protected static Logger setupLogger() {
    final Logger logger = Utils.getLogger();
    File logDirectory = new File(Utils.getLauncherDirectory(), "logs");
    if (!logDirectory.exists()) {
      logDirectory.mkdir();
    }
    File logs = new File(logDirectory, "lovelauncher_%D.log");
    RotatingFileHandler fileHandler = new RotatingFileHandler(logs.getPath());

    fileHandler.setFormatter(new TechnicLogFormatter());

    for (Handler h : logger.getHandlers()) {
      logger.removeHandler(h);
    }
    logger.addHandler(fileHandler);

    SpoutcraftLauncher.handler = fileHandler;

    if (params != null && !params.isDebugMode()) {
      logger.setUseParentHandlers(false);

      System.setOut(new PrintStream(new LoggerOutputStream(console, Level.INFO, logger), true));
      System.setErr(new PrintStream(new LoggerOutputStream(console, Level.SEVERE, logger), true));
    }

    Thread.setDefaultUncaughtExceptionHandler(
        new Thread.UncaughtExceptionHandler() {
          @Override
          public void uncaughtException(Thread t, Throwable e) {
            logger.log(Level.SEVERE, "Unhandled Exception in " + t, e);

            if (errorDialog == null) {
              LauncherFrame frame = null;

              try {
                frame = Launcher.getFrame();
              } catch (Exception ex) {
                // This can happen if we have a very early crash- before Launcher initializes
              }

              errorDialog = new ErrorDialog(frame, e);
              errorDialog.setVisible(true);
            }
          }
        });

    return logger;
  }
  @Override
  public boolean isFileValid(File file) {
    try {
      String json = FileUtils.readFileToString(file, Charset.forName("UTF-8"));
      JsonObject obj = Utils.getMojangGson().fromJson(json, JsonObject.class);

      return (obj != null);
    } catch (Exception ex) {
      System.out.println(
          "An exception was raised while verifying "
              + file.getAbsolutePath()
              + "- this probably just means the file is invalid, in which case this is not an error:");
      ex.printStackTrace();
    }

    return false;
  }
 private static void cleanup() {
   File temp = new File(Utils.getLauncherDirectory(), "temp.jar");
   temp.delete();
   temp = new File(Utils.getLauncherDirectory(), "temp.exe");
   temp.delete();
 }