I am trying to get the method from another class using reflection, but for some reason it keeps on giving me a no such method exception. These are the classes im using:
ScriptTable class:
for(Class<?> script: Scripts) {
System.out.println(script.getName());
try {
Method c = script.getMethod("scriptInfo()", script);
} catch(Exception e) {
e.printStackTrace();
}
}
DummyScript class
public String[] scriptInfo() {
String[] ScriptInfo = {"DummyScript", "Chris", "Does nothing atm"};
return ScriptInfo;
}
This is your problem:
change it to:
and look here to see why:
http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#getMethod%28java.lang.String,%20java.lang.Class...%29