public void updateLauncher() { Logger.info("Checking lastest version"); LauncherVersion localVersion = LauncherVersion.getLocalVersion(); Logger.info("Local version is %s", localVersion); LauncherVersion remoteVersion = fetchRemoteVersion(); Logger.info("Remote version is %s", remoteVersion); if (localVersion.compareTo(remoteVersion) >= 0) { // already lastest version Logger.info("Already lastest version (%s/%s", localVersion, remoteVersion); return; } Logger.info("Performing update to %s", remoteVersion); try { File localBinary = getLocalFile(); String format = getExtension(localBinary); Logger.info("Local file: %s", localBinary.getAbsolutePath()); Logger.info("Downloading update"); File tempUpdater = downloadUpdate(remoteVersion, format); Logger.info("Downloaded update to %s", tempUpdater.getAbsolutePath()); Logger.info("Launching self-updater"); String updater = tempUpdater.getAbsolutePath(); PlatformUtils.launchJavaApplication( updater, LauncherUpdater.class.getCanonicalName(), updater, localBinary.getAbsolutePath()); Logger.info("Now exiting to unlock file"); System.exit(0); Logger.info("If you are watching this you are pretty much a pirate now!"); } catch (IOException e) { Logger.error("Error during launcher update: ", e.getMessage()); } }