Hi,
In my applet, I have this:
public String callMethod(String methodName, String methodArg) throws
Exception {
try {
Class midletClass = midlet.getClass();
System.out.println("midlet class is " + midletClass);
Method []ms = midletClass.getMethods();
for (int i = 0; i < ms.length; i++ ) {
System.out.println("method: " + ms[i]);
}
Method m = midletClass.getMethod(
methodName, new Class[] { String.class });
m.invoke(
midlet, new Object[] { methodArg });
return "OK";
} catch (Exception e) {
String failstr = "Problem calling method '" + methodName +
"' with argument '" + methodArg + "' \n" + e;
System.err.println(failstr);
e.printStackTrace();
return "FAIL: " + failstr;
}
}
However, it's not printing, or invoking this method, defined in a .jar
loaded by the first jar:
public void setScript(String s) { .... }
It gives a not found error when I try and invoke it, and when I try and
print it by accessing' midlets with getMethods, it doesn't show it.
The applet loads the .jar like so:
Class midletClass;
try {
midletClass = Class.forName(midletClassName);
} catch (ClassNotFoundException ex) {
System.out.println("Cannot find " + midletClassName + "
MIDlet class");
return;
}
try {
midlet = (MIDlet) midletClass.newInstance();
} catch (Exception ex) {
System.out.println("Cannot initialize " + midletClass + "
MIDlet class");
System.out.println(ex);
ex.printStackTrace();
return;
}
(Note that it's not actually running in a J2ME environment, despite the
'midlet' label.)
I'm out of ideas, more or less...

Signature
David N. Welton
- http://www.dedasys.com/davidw/
Linux, Open Source Consulting
- http://www.dedasys.com/
andrewthommo@gmail.com - 15 Mar 2006 00:34 GMT
....
> However, it's not printing, or invoking this method, defined in a .jar
> loaded by the first jar:
[quoted text clipped - 3 lines]
> It gives a not found error when I try and invoke it, and when I try and
> print it by accessing' midlets with getMethods, it doesn't show it.
What exactly do you mean in this 'not found error'? What is not found?
Better, where is the URL of your applet?
(As an aside, I suggest you rewrite your example losing all references
to 'midlet' - you are not helping people to help you, by introducing
other
possibilities that are not related to the problem..)
Andrew T.