From what I understand from the question, you have executed such a file, and it is launched in order to say that Project A and its work. Now you want to use it in Project B. You cannot directly use the compilation library in Project B. The problem is your signature function inside your code. For different package names, the corresponding function signature will be changed.
JNIEXPORT jint JNICALL Java_com_your_packageA_class_method(JNIEnv *d, jobject e, jstring f) {
You need a jar that contains classes for calling your own functions with your compiled such file to make it accessible to Project B.
Here's how it will work. Project B will make a jar call, which will call the compiled file and return the result in A.
source share