Package de.idos.updates.demo

Source Code of de.idos.updates.demo.DemoBootLoader

package de.idos.updates.demo;

import de.idos.updates.UpdateSystem;
import de.idos.updates.configuration.ConfiguredUpdateSystem;
import net.sf.anathema.ApplicationLauncher;

import java.io.File;

public class DemoBootLoader {

  public static final String MAIN_CLASS = "de.idos.updates.Demo";
  public static final String MAIN_METHOD = "startDemo";

  public static void main(String[] arguments) throws Exception {
    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);
    }
  }

  private static boolean mainClassAlreadyOnClasspath() {
    try {
      ClassLoader.getSystemClassLoader().loadClass(MAIN_CLASS);
      return true;
    } catch (ClassNotFoundException e) {
      return false;
    }
  }
}
TOP

Related Classes of de.idos.updates.demo.DemoBootLoader

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.