// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class MainRecursive {
    public static void main(String[] args) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException, ClassNotFoundException {
        if(args.length > 0 && args[0].equals("R")) {
            System.out.println("R");
        } else {
            System.out.println("normal");
            Class declarg[] = new Class[1];
            declarg[0] = String[].class;
            Method m = Class.forName("MainRecursive").getMethod("main", declarg);
            Object callarg[] = new Object[1];
            callarg[0] = new String[] { "R" };
            m.invoke(null, callarg);
        }
    }
}
