diff options
Diffstat (limited to 'src/share/classes/sun/launcher/LauncherHelper.java')
-rw-r--r-- | src/share/classes/sun/launcher/LauncherHelper.java | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/share/classes/sun/launcher/LauncherHelper.java b/src/share/classes/sun/launcher/LauncherHelper.java index 96ad48446..8cca710da 100644 --- a/src/share/classes/sun/launcher/LauncherHelper.java +++ b/src/share/classes/sun/launcher/LauncherHelper.java @@ -151,7 +151,7 @@ public enum LauncherHelper { throw new IOException("no main mainifest attributes, in " + jarname); } - return mainAttrs.getValue(MAIN_CLASS); + return mainAttrs.getValue(MAIN_CLASS).trim(); } finally { if (jarFile != null) { jarFile.close(); @@ -207,10 +207,9 @@ public enum LauncherHelper { throw new RuntimeException("Main method not found in " + classname); } /* - * Usually the getMethod (above) will choose the correct method, based - * on its modifiers and parameter types, the only check required is the - * getReturnType check as getMethod does not check for this, all the - * other modifier tests are redundant, and are simply here for safety. + * getMethod (above) will choose the correct method, based + * on its name and parameter type, however, we still have to + * ensure that the method is static and returns a void. */ int mod = method.getModifiers(); if (!Modifier.isStatic(mod)) { @@ -219,12 +218,6 @@ public enum LauncherHelper { throw new RuntimeException("Main method is not static in class " + classname); } - if (!Modifier.isPublic(mod)) { - ostream.println(getLocalizedMessage("java.launcher.cls.error2", - "public", classname)); - throw new RuntimeException("Main method is not public in class " + - classname); - } Class<?> rType = method.getReturnType(); if (!rType.isPrimitive() || !rType.getName().equals("void")) { ostream.println(getLocalizedMessage("java.launcher.cls.error3", |