|
用反射调用一个类中的main方法。 我的做法是:将要被调用的main方法所属类打包在另一个单独的文件夹(ReflectFile)下。ReflectPoint.class文件和ReflectFile文件夹在同一个文件夹下。运行时语句:java ReflectPoint ReflectFile.TestArg 运行报错:java.lang.IllegalAccessException: Class ReflectPoint can not access a member of class ReflectFile1.TestArg with modifiers "public static" |
|