public static void main(String[] args) throws IOException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
        LogUtils.ensureConfigured();
        
        //temp patch code to create log file
        DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy");
		Date date = new Date();
        PrintWriter out = new PrintWriter(new FileWriter("log.txt"),true);
        out.print(dateFormat.format(date));
        out.close();
        
        
        IBackgroundReporter reporter;

        if(args.length == 0) {
            // gui
            reporter = new DialogBackgroundReporter(null, "Downloading") {
            };
        } else {
            // console
            reporter = new IBackgroundReporter() {
                @Override
                public void reset(int max) {
                    // ignored in console
                }

                @Override
                public Closeable beginAction(final String name) {
                    Logger.info("Started " + name);

                    return new Closeable() {
                        @Override
                        public void close() throws IOException {
                            Logger.info("Ended " + name);
                        }
                    };
                }

                @Override
                public void end() {
                    // ignored in console
                }

                @Override
                public void warn(String message, String title) {
                    System.out.println(message);
                }

                @Override
                public void error(String message, String title) {
                    System.err.println(message);
                }
            };
        }

        Version launcherVersion = null;
        Enumeration<URL> resources = ContextUtils.get().getResources("META-INF/MANIFEST.MF");

        manifests:
        while(resources.hasMoreElements()) {
            URL resource = resources.nextElement();
            try(InputStream is = resource.openStream()) {
                Manifest mf = new Manifest(is);

                Attributes main = mf.getMainAttributes();
                String versionString = get(main, "Launcher-Version");
                if(versionString != null) {
                    launcherVersion = Version.valueOf(versionString);
                    break manifests;
                }
            }
        }

        if(launcherVersion == null)
        {
            reporter.error("No launcher version found", "Invalid launcher");
            System.exit(1);
        }


        IConfigSystem configSystem = ConfiguredConfigSystem.createFromClassPath();
        IUpdateSystem updateSystem = ConfiguredUpdateSystem.createFromClassPath(reporter);
        ILaunchSystem launchSystem = ConfiguredLaunchSystem.createFromClassPath(reporter, launcherVersion);

        updateSystem.checkUpToDate(launcherVersion);

        String appId = configSystem.getAppId();
        IPackage pack = updateSystem.findPackage(appId);
        Version latestVersion = pack.getLastVersion();

        if(!launchSystem.hasInstalled(appId, latestVersion)) {
            launchSystem.deleteAll(appId);
            launchSystem.installLatest(pack);
        }

        reporter.end();
        try {
            launchSystem.launch(appId, latestVersion, args);
        } catch (Exception ex) {
            Logger.error(ex, "Error in launced application");
        }
    }