新10 1-
47:こんなJVM / :
public class po {
public static void main(String[] args) throws Throwable {
String[] realArgs = new String[args.length - 1];
for (int i = 0; i < realArgs.length; i++) realArgs[i] = realArgs[i + 1];
try {
Class.forName(args[0]).getDeclaredMethod("main", new Class[]{String[].class}).invoke(null, new Object[]{realArgs});
} catch (java.lang.reflect.InvocationTargetException e) {
if (e.getCause() instanceof NullPointerException)
System.err.println("∧_∧ \n ( ´∀`)< ぬるぽ\n");
throw e.getCause();
}
}
}
class Hello {
public static void main(String[] args) {
((Hello)null).toString();
}
}
結果:
java po Hello
∧_∧
( ´∀`)< ぬるぽ
Exception in thread "main" java.lang.NullPointerException
at Hello.main(po.java:16)


ir ver 1.0 beta2.2 (03/10/22)