jdk/src/share/classes/sun/launcher/LauncherHelper.java
changeset 15682 793a36de151d
parent 15003 364408faddeb
child 15687 9f473a0b9e86
--- a/jdk/src/share/classes/sun/launcher/LauncherHelper.java	Mon Jan 21 23:17:58 2013 -0500
+++ b/jdk/src/share/classes/sun/launcher/LauncherHelper.java	Mon Jan 21 23:20:42 2013 -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 = "    ";
@@ -418,6 +422,28 @@
                     new Attributes.Name(FXHelper.JAVAFX_APPLICATION_MARKER))) {
                 return FXHelper.class.getName();
             }
+
+            /*
+             * 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);