We often use javah to generate JNI header files and then implement the JNI method defined by ourselves. This method is more traditional, we can see that the defined format and even the name must follow the standard [cpp] JNIEXPORT jint JNICALL Java_test_symlink (JNIEnv *, jobject, jstring, jstring); the complete structure is Java_classpath_classname_native method name, in this way, the corresponding native method can be found according to the naming rule when the jvm runs. In fact, jvm also provides the direct RegisterNative Method for manual registration of native methods. The following is a code example [cpp] static JNINativeMethod methods [] = {"retrieveDirectives ","() ljava/lang/assertionstatusdireves; ", (void *) & JVM_AssertionStatusDirectives}; (* env)-> RegisterNatives (env, cls, methods, sizeof (methods) /sizeof (JNINativeMethod); RegisterNative (JNIEnv, jclass cls, JNINativeMethod * methods, jint number) 1. methods is a two-dimensional array that represents the implementation method corresponding to each native method in this class. In the previous example, it indicates that a native method retrieveDiretives, and the returned value is AssertionStatusDirectives, the local method for execution is jvm_assertionstatusdireves ves 2. the following number indicates the number of native to be specified. The implementation of RegisterNative is very simple, the address of the native method in the class + 1 points to the function address of the executed c code, that is, the above & JVM_AssertionStatusDirectives [cpp] address * native_function_addr () const {assert (is_native (), "must be native"); return (address *) (this + 1 );