/** * Attempt to launch the application through the enhanced main method. * <p/> * <p/> * This will seek a method with the exact signature of: * </p> * <p/> * <pre> * public static void main(String[] args, ClassWorld world) * </pre> * * @throws ClassNotFoundException If the main entry class cannot be found. * @throws IllegalAccessException If the method cannot be accessed. * @throws java.lang.reflect.InvocationTargetException * If the target of the invokation is * invalid. * @throws NoSuchMethodException If the main entry method cannot be found. * @throws NoSuchRealmException If the main entry realm cannot be found. */ protected void launchX() throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NoSuchRealmException { ClassRealm mainRealm = getMainRealm(); Class mainClass = getMainClass(); Method mainMethod = getEnhancedMainMethod(); Thread.currentThread().setContextClassLoader( mainRealm.getClassLoader() ); mainMethod.invoke( mainClass, new Object[]{getWorld()} ); }