if (mainClassAlreadyOnClasspath()) {
ApplicationLauncher.loadFromSystemClasspath().launch(MAIN_CLASS, MAIN_METHOD);
}
else{
UpdateSystem updateSystem = ConfiguredUpdateSystem.loadProperties().create();
updateSystem.reportAllProgressTo(new ConsoleReport());
updateSystem.checkForUpdates().updateToLatestVersion();
File versionFolder = updateSystem.getFolderForVersionToRun();
ApplicationLauncher.loadFromFolder(versionFolder).launch(MAIN_CLASS, MAIN_METHOD);
}
}