I am looking at Yahoo's YUI compressor executable jar and they have this class, linked from Manifest file as "Main-Class":
package com.yahoo.platform.yui.compressor;
import java.lang.reflect.Method;
public class Bootstrap {
public static void main(String args[]) throws Exception {
ClassLoader loader = new JarClassLoader();
Thread.currentThread().setContextClassLoader(loader);
Class c = loader.loadClass(YUICompressor.class.getName());
Method main = c.getMethod("main", new Class[]{String[].class});
main.invoke(null, new Object[]{args});
}
}
Which looks like a useless wrapper to me. Why not just directly put YUICompressor
as the Main-Class? Is there any reason for doing it this way?
Thanks.