Jerikc XIONG
Jerikc XIONG

Reputation: 3607

What's the difference between xxx(JNIEnv *env, jobject thisObj) and xxx(JNIEnv *env, jclass cls)?

I saw some jni signatures as the following:

// jni
// WAY-1
JNIEXPORT void JNICALL Java_com_test_Test_testMethod(JNIEnv *env,  jobject thisObj);

// WAY-2
JNIEXPORT void JNICALL Java_com_test_Test_testMethod(JNIEnv *env, jclass cls);

And the java code maybe like this:

// java
package com.test;

public class Test {
    public native void testMethod(); 
}

What's the difference between WAY-1 and WAY-2 ?

Upvotes: 0

Views: 544

Answers (1)

JesperE
JesperE

Reputation: 64424

The second call signature (WAY-2) is used for static methods, which do not have an object instance.

Upvotes: 1

Related Questions