For someone who wants to use Java code in C by JNI, you can call by jni with Java class or JAR(Java ARchive). Here is an example of how to let C call function in jar by JNI.
Notes:
If the java package name is a.b.c and the class name is ClassName, the parameter passed into (*env)->FindClass should be converted to (*env)->FindClass(env, "a/b/c/ClassName");
Set the option -Djava.class.path=./your_jar_or java_class_file_location in JavaVMOption well. Use ‘:’ in Unix or ‘;’ in Windows as a seperator if having multiple jars.
Set ignoreUnrecognized to JNI_FALSE for more error message like Unrecognized option:.
ls -a $(which java). Should get a path which includes yourpath/Home/bin/java, then yourpath/Home is the value needs to be set as JAVA_HOME. In my case it’s /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home.
Search those .h file in this path.
Read jni.h for functions and types that we can use.