runtime/java/v21/lib/src/Launcher.java [30:78]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 class Launcher {

     private static String mainClassName = "Main";
     private static String mainMethodName = "main";
     private static Class mainClass = null;
     private static Method mainMethod = null;

     @SuppressWarnings({ "unchecked", "rawtypes" })
     private static void augmentEnv(Map<String, String> newEnv) {
         try {
             for (Class cl : Collections.class.getDeclaredClasses()) {
                 if ("java.util.Collections$UnmodifiableMap".equals(cl.getName())) {
                     Field field = cl.getDeclaredField("m");
                     field.setAccessible(true);
                     Object obj = field.get(System.getenv());
                     Map<String, String> map = (Map<String, String>) obj;
                     map.putAll(newEnv);
                 }
             }
         } catch (Exception e) {}
     }

     private static void initMain(String[] args) throws Exception {
         if(args.length > 0)
             mainClassName = args[0];
         int pos = mainClassName.indexOf("#");
         if(pos != -1) {
             if(pos + 1 != mainClassName.length())
                 mainMethodName = args[0].substring(pos+1);
             mainClassName = args[0].substring(0,pos);
         }

         mainClass = Class.forName(mainClassName);
         Method[] methods = mainClass.getDeclaredMethods();
         Boolean existMain = false;
         for(Method method: methods) {
             if (method.getName().equals(mainMethodName)) {
                 existMain = true;
                 break;
             }
         }
         if (!existMain) {
             throw new NoSuchMethodException(mainMethodName);
         }
     }

     private static Object invokeMain(JsonElement arg, Map<String, String> env) throws Exception {
         augmentEnv(env);
         return mainMethod.invoke(null, arg);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



runtime/java/v8/lib/src/Launcher.java [29:77]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
class Launcher {

    private static String mainClassName = "Main";
    private static String mainMethodName = "main";
    private static Class mainClass = null;
    private static Method mainMethod = null;

    @SuppressWarnings({ "unchecked", "rawtypes" })
    private static void augmentEnv(Map<String, String> newEnv) {
        try {
            for (Class cl : Collections.class.getDeclaredClasses()) {
                if ("java.util.Collections$UnmodifiableMap".equals(cl.getName())) {
                    Field field = cl.getDeclaredField("m");
                    field.setAccessible(true);
                    Object obj = field.get(System.getenv());
                    Map<String, String> map = (Map<String, String>) obj;
                    map.putAll(newEnv);
                }
            }
        } catch (Exception e) {}
    }

    private static void initMain(String[] args) throws Exception {
        if(args.length > 0)
            mainClassName = args[0];
        int pos = mainClassName.indexOf("#");
        if(pos != -1) {
            if(pos + 1 != mainClassName.length())
                mainMethodName = args[0].substring(pos+1);
            mainClassName = args[0].substring(0,pos);
        }

        mainClass = Class.forName(mainClassName);
        Method[] methods = mainClass.getDeclaredMethods();
        Boolean existMain = false;
        for(Method method: methods) {
            if (method.getName().equals(mainMethodName)) {
                existMain = true;
                break;
            }
        }
        if (!existMain) {
            throw new NoSuchMethodException(mainMethodName);
        }
    }

    private static Object invokeMain(JsonElement arg, Map<String, String> env) throws Exception {
        augmentEnv(env);
        return mainMethod.invoke(null, arg);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



