Why does this fail with the error :
Args are: -normi -nosplash
Exception in thread "main" java.lang.IllegalArgumentException: wrong
number of arguments
at sun.reflect.NativeConstructorAccessorImpl
.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl
.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl
.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at TSStack.main(TSStack.java:14)
Here is the code:
public static void main(String args[]) throws Exception {
System.out.println("Args are: " + args[0]+ " " + args[1] );
try {
Constructor<Site> c = Site.class.getDeclaredConstructor();
c.setAccessible(true); // use reflection to get access to
//this private constructor
c.newInstance( (Object[])args );
} catch (InvocationTargetException x) {
x.printStackTrace();
} catch (NoSuchMethodException x) {
x.printStackTrace();
} catch (InstantiationException x) {
x.printStackTrace();
} catch (IllegalAccessException x) {
x.printStackTrace();
}
}