AppCompiler { public static void main(String[] args) throws IOException { AppCompiler compiler = null; ConfigBuilder configBuilder = null; configBuilder = new ConfigBuilder(); ConfigBuilderArgParser argParser = new ConfigBuilderArgParser(CommandArgs.options(), args); try { argParser.validate(); if (!argParser.validateArgs(argParser.getCmd())) { argParser.usage(CommandArgs.options()); return; } } catch (IllegalArgumentException iae) { System.err.println(iae.getMessage()); return; } catch (ParseException e) { System.out.println("Error processing options -- this is a bug. Please report"); e.printStackTrace(); } configBuilder = argParser.populateObject(configBuilder); configBuilder = processArgs(configBuilder, args); compiler = new AppCompiler(configBuilder.build()); boolean run = false; try { if (configBuilder.getConfig().isArchive()) { compiler.build(); compiler.archive(); } else { if (run && !compiler.config.getTarget().canLaunch()) { throw new IllegalArgumentException("Cannot launch when building " + compiler.config.getTarget().getType() + " binaries"); } if (run) { compiler.compile(); LaunchParameters launchParameters = compiler.config.getTarget().createLaunchParameters(); launchParameters.setArguments(configBuilder.getConfig().getRunArgs()); compiler.launch(launchParameters); } else if(compiler.config.isBuildAsLib()) { compiler.compile(); } else { compiler.build(); compiler.config.getTarget().install(); } } } catch (Throwable t) { String message = t.getMessage(); if (configBuilder.getConfig().verbose && !(t instanceof ExecuteException)) { t.printStackTrace(); } printAndExit(message); } } AppCompiler(Config config); Config getConfig(); Set<Clazz> compile(Set<Clazz> rootClasses, boolean compileDependencies,
            final ClassCompilerListener listener); static void main(String[] args); static ConfigBuilder processArgs(ConfigBuilder configBuilder, String[] args); void build(); void archive(); void install(); int launch(LaunchParameters launchParameters); int launch(LaunchParameters launchParameters, InputStream inputStream); Process launchAsync(LaunchParameters launchParameters); Process launchAsync(LaunchParameters launchParameters, InputStream inputStream); void launchAsyncCleanup();  }
@Test public void testMain() throws IOException { AppCompiler.main(new String[] {}); AppCompiler.main(new String[]{"-?"}); }