--- old/src/share/classes/sun/launcher/LauncherHelper.java 2014-04-29 16:27:13.000000000 -0700 +++ new/src/share/classes/sun/launcher/LauncherHelper.java 2014-04-29 16:27:13.000000000 -0700 @@ -69,6 +69,14 @@ public enum LauncherHelper { INSTANCE; + + // used to identify JavaFX applications + private static final String JAVAFX_APPLICATION_MARKER = + "JavaFX-Application-Class"; + private static final String JAVAFX_APPLICATION_CLASS_NAME = + "javafx.application.Application"; + private static final String JAVAFX_FXHELPER_CLASS_NAME_SUFFIX = + "LauncherHelper$FXHelper"; private static final String MAIN_CLASS = "Main-Class"; private static StringBuilder outBuf = new StringBuilder(); @@ -418,7 +426,8 @@ * exists to enforce compliance with the jar specification */ if (mainAttrs.containsKey( - new Attributes.Name(FXHelper.JAVAFX_APPLICATION_MARKER))) { + new Attributes.Name(JAVAFX_APPLICATION_MARKER))) { + FXHelper.setFXLaunchParameters(jarname, LM_JAR); return FXHelper.class.getName(); } @@ -516,9 +525,9 @@ * the main class may or may not have a main method, so do this before * validating the main class. */ - if (mainClass.equals(FXHelper.class) || - FXHelper.doesExtendFXApplication(mainClass)) { - // Will abort() if there are problems with the FX runtime + if ( mainClass.getName().contains(JAVAFX_FXHELPER_CLASS_NAME_SUFFIX) || + doesExtendFXApplication(mainClass)) { + // Will abort() if there are problems with FX runtime FXHelper.setFXLaunchParameters(what, mode); return FXHelper.class; } @@ -537,6 +546,21 @@ return appClass; } + /* + * Check if the given class is a JavaFX Application class. This is done + * in a way that does not cause the Application class to load or throw + * ClassNotFoundException if the JavaFX runtime is not available. + */ + private static boolean doesExtendFXApplication(Class mainClass) { + for (Class sc = mainClass.getSuperclass(); sc != null; + sc = sc.getSuperclass()) { + if (sc.getName().equals(JAVAFX_APPLICATION_CLASS_NAME)) { + return true; + } + } + return false; + } + // Check the existence and signature of main and abort if incorrect static void validateMainClass(Class mainClass) { Method mainMethod; @@ -545,7 +569,7 @@ } catch (NoSuchMethodException nsme) { // invalid main or not FX application, abort with an error abort(null, "java.launcher.cls.error4", mainClass.getName(), - FXHelper.JAVAFX_APPLICATION_CLASS_NAME); + JAVAFX_APPLICATION_CLASS_NAME); return; // Avoid compiler issues } @@ -563,6 +587,7 @@ abort(null, "java.launcher.cls.error3", mainMethod.getDeclaringClass().getName()); } + return; } private static final String encprop = "sun.jnu.encoding"; @@ -668,11 +693,7 @@ } static final class FXHelper { - // Marker entry in jar manifest that designates a JavaFX application jar - private static final String JAVAFX_APPLICATION_MARKER = - "JavaFX-Application-Class"; - private static final String JAVAFX_APPLICATION_CLASS_NAME = - "javafx.application.Application"; + private static final String JAVAFX_LAUNCHER_CLASS_NAME = "com.sun.javafx.application.LauncherImpl"; @@ -742,21 +763,6 @@ } } - /* - * Check if the given class is a JavaFX Application class. This is done - * in a way that does not cause the Application class to load or throw - * ClassNotFoundException if the JavaFX runtime is not available. - */ - private static boolean doesExtendFXApplication(Class mainClass) { - for (Class sc = mainClass.getSuperclass(); sc != null; - sc = sc.getSuperclass()) { - if (sc.getName().equals(JAVAFX_APPLICATION_CLASS_NAME)) { - return true; - } - } - return false; - } - public static void main(String... args) throws Exception { if (fxLauncherMethod == null || fxLaunchMode == null --- old/test/tools/launcher/FXLauncherTest.java 2014-04-29 16:27:14.000000000 -0700 +++ new/test/tools/launcher/FXLauncherTest.java 2014-04-29 16:27:14.000000000 -0700 @@ -373,6 +373,11 @@ System.out.println(tr); throw new Exception("jfxrt.jar is being loaded, it should not be!"); } + if (!tr.notContains("sun.launcher.LauncherHelper$FXHelper")) { + System.out.println("testing for extraneous 'sun.launcher.LauncherHelper$FXHelper'"); + System.out.println(tr); + throw new Exception("FXHelper is being loaded, it should not be!"); + } for (String p : APP_PARMS) { if (!tr.contains(p)) { System.err.println("ERROR: Did not find "