Need Help With CallVoidMethod
I'm having trouble getting a call to a java method to work after invoking a jvm successfully. Find class and getmethodid work correctly, but the call to the method using CallVoidMethod returns an error (listed below).
Anyone know what I might be doing wrong?
The native code snippet:
jclass manager = env->FindClass("com/jnitester/MainClass");
if (manager == NULL) {
writetolog("** ERROR");
}
else
{
writetolog("successfully loaded com/jnitester/MainClass");
}
jmethodID loadcl_mid = env->GetMethodID(manager, "DoSomething", "()V");
if (loadcl_mid == NULL) {
writetolog("** ERROR: cannot find method ");
}
else
{
writetolog("java method loaded");
}
env->CallVoidMethod(manager, loadcl_mid);
The output I get is:
successfully loaded com/jnitester/MainClass
java method loaded
Invalid memory access of location 00000000 eip=9ec6d0cd
The java "MainClass" code is as follows:
package com.jnitester;
public class MainClass
{
public MainClass()
{
System.out.println("Here in MainClass");
}
public void DoSomething()
{
System.out.println("Here in Do Something");
}
}

