Is it a bug in JNI...CallVoidMethod(..) giving runtime error?

Hi

I have invoked jvm using C++. I called the main method of my application and it is running fine.

When I try to invoke another method of the same class that is not static by GetMethodID(..) and then CallVoidMethod(..), the ID is coming out fine but the call to the method is giving a runtime error.

When I make this method static in java, it runs fine.

Is it a bug in JNI that we cannot call nonstatic void methods?

[457 byte] By [zeeshanarif] at [2007-9-26 5:25:49]
# 1
Are you - somewhere - creating an object of that class and somehow getting a refernce to it? Or are you - illegally - trying to call an object method on a classid?
bschauwe at 2007-6-29 19:33:45 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2

I have declared the jclass cls object in global space in C++ file. I use the FindClass(..) function to find it. Everything is turning out to be fine till I call the main() function of the java class.

Now when I get the Id using the GetMethod(..) function of JNI, it comes out fine and gives no errors. It is only when I call the CallVoidMethod(...), it gives me a runtime error. I have tried to use this method in java without C++ and it gives no error.

Any idea .. what may be wrong?

zeeshanarif at 2007-6-29 19:33:45 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3
Provide the C code segement where you get the instance of the object and then invoke the method. Also provide the signature of the java method.
jschell at 2007-6-29 19:33:46 > top of Java-index,Java HotSpot Virtual Machine,Specifications...