Preconditions.checkArgument(mainClassName != null && !mainClassName.isEmpty(),
"Main class attribute cannot be empty");
File unpackedJarDir = Files.createTempDir();
try {
Object appMain = new Archive(BundleJarUtil.unpackProgramJar(archive, unpackedJarDir),
mainClassName).getMainClass().newInstance();
if (!(appMain instanceof Application)) {
throw new IllegalStateException(String.format("Application main class is of invalid type: %s",
appMain.getClass().getName()));
}