-1

I have this java method:

public static native void processBuffer(ByteBuffer bb);

with javah

JNIEXPORT void JNICALL Java_com_lan_factorial_IssmJni_processBuffer
  (JNIEnv *env, jclass klass , jobject buf)

work perfectly

with Jni onload

static JNINativeMethod method_table[] = {
        {"fac"      ,     "(J)J" , (void *) factorial},
        {"getBuffer",     "()[D" , (void *) getBufferNative},
        //{"processBuffer", "(Ljava/nio/ByteBuffer)V", (void *) fillBuffer}};

The others method in this table works, exept the last one which correspond to the method generate from javah above. And of course if I do JNI onload i will have a method call fillBuffer.

Can someone explain why javah works but not jni_onload. Did I do something wrong? I have other methods using jni_onload so I want to stay away from javah.

Thanks

Phil Wright
  • 180
  • 1
  • 9
Lan Nguyen
  • 329
  • 1
  • 3
  • 10

1 Answers1

1

You have a missing semicolon in the method signature. It doesn't 'correspond' at all. Don't guess at native method signatures: use the output of javap -s. Cut and paste.

user207421
  • 305,947
  • 44
  • 307
  • 483