--- old/src/share/classes/sun/launcher/LauncherHelper.java 2013-01-08 02:20:20.145062551 -0500 +++ new/src/share/classes/sun/launcher/LauncherHelper.java 2013-01-08 02:20:18.712981898 -0500 @@ -65,10 +65,14 @@ import java.util.jar.Attributes; import java.util.jar.JarFile; import java.util.jar.Manifest; +import sun.misc.Version; +import sun.misc.URLClassPath; public enum LauncherHelper { INSTANCE; private static final String MAIN_CLASS = "Main-Class"; + private static final String PROFILE = "Profile"; + private static StringBuilder outBuf = new StringBuilder(); private static final String INDENT = " "; @@ -409,6 +413,25 @@ if (mainValue == null) { abort(null, "java.launcher.jar.error3", jarname); } + + // if this is not a full JRE then the Profile attribute must be + // present with the Main-Class attribute so as to indicate the minimum + // profile required. Note that we need to suppress checking of the Profile + // attribute after we detect an error. This is because the abort may + // need to lookup resources and this may involve opening additional JAR + // files that would result in errors that suppress the main error. + String profile = mainAttrs.getValue(PROFILE); + if (profile == null) { + if (!Version.isFullJre()) { + URLClassPath.suppressProfileCheckForLauncher(); + abort(null, "java.launcher.jar.error4", jarname); + } + } else { + if (!Version.supportsProfile(profile)) { + URLClassPath.suppressProfileCheckForLauncher(); + abort(null, "java.launcher.jar.error5", profile, jarname); + } + } return mainValue.trim(); } catch (IOException ioe) { abort(ioe, "java.launcher.jar.error1", jarname); @@ -703,4 +726,3 @@ } } } -