63 import java.util.Set; |
63 import java.util.Set; |
64 import java.util.TreeSet; |
64 import java.util.TreeSet; |
65 import java.util.jar.Attributes; |
65 import java.util.jar.Attributes; |
66 import java.util.jar.JarFile; |
66 import java.util.jar.JarFile; |
67 import java.util.jar.Manifest; |
67 import java.util.jar.Manifest; |
68 import sun.misc.Version; |
|
69 import sun.misc.URLClassPath; |
|
70 |
68 |
71 public enum LauncherHelper { |
69 public enum LauncherHelper { |
72 INSTANCE; |
70 INSTANCE; |
73 private static final String MAIN_CLASS = "Main-Class"; |
71 private static final String MAIN_CLASS = "Main-Class"; |
74 private static final String PROFILE = "Profile"; |
|
75 |
72 |
76 private static StringBuilder outBuf = new StringBuilder(); |
73 private static StringBuilder outBuf = new StringBuilder(); |
77 |
74 |
78 private static final String INDENT = " "; |
75 private static final String INDENT = " "; |
79 private static final String VM_SETTINGS = "VM settings:"; |
76 private static final String VM_SETTINGS = "VM settings:"; |
410 abort(null, "java.launcher.jar.error3", jarname); |
407 abort(null, "java.launcher.jar.error3", jarname); |
411 } |
408 } |
412 mainValue = mainAttrs.getValue(MAIN_CLASS); |
409 mainValue = mainAttrs.getValue(MAIN_CLASS); |
413 if (mainValue == null) { |
410 if (mainValue == null) { |
414 abort(null, "java.launcher.jar.error3", jarname); |
411 abort(null, "java.launcher.jar.error3", jarname); |
415 } |
|
416 |
|
417 /* |
|
418 * If this is not a full JRE then the Profile attribute must be |
|
419 * present with the Main-Class attribute so as to indicate the minimum |
|
420 * profile required. Note that we need to suppress checking of the Profile |
|
421 * attribute after we detect an error. This is because the abort may |
|
422 * need to lookup resources and this may involve opening additional JAR |
|
423 * files that would result in errors that suppress the main error. |
|
424 */ |
|
425 String profile = mainAttrs.getValue(PROFILE); |
|
426 if (profile == null) { |
|
427 if (!Version.isFullJre()) { |
|
428 URLClassPath.suppressProfileCheckForLauncher(); |
|
429 abort(null, "java.launcher.jar.error4", jarname); |
|
430 } |
|
431 } else { |
|
432 if (!Version.supportsProfile(profile)) { |
|
433 URLClassPath.suppressProfileCheckForLauncher(); |
|
434 abort(null, "java.launcher.jar.error5", profile, jarname); |
|
435 } |
|
436 } |
412 } |
437 |
413 |
438 /* |
414 /* |
439 * Hand off to FXHelper if it detects a JavaFX application |
415 * Hand off to FXHelper if it detects a JavaFX application |
440 * This must be done after ensuring a Main-Class entry |
416 * This must be done after ensuring a Main-Class entry |