0x05 JNI中如何catch exception 并把从Java传入JNI的错误抛出

    if (env->ExceptionCheck()) {
        string errMsg = "E JNI - " + fun + " callback exception!";
        LogUtils::getInstance()->logE( errMsg + " exception occured in jni");
        env->ExceptionDescribe();
        env->ExceptionClear();
        jclass jc = env->FindClass("java/lang/Exception");
        if(jc) env->ThrowNew (jc, errMsg.c_str());
        env->DeleteLocalRef(jc);
    }

你可能感兴趣的:(0x05 JNI中如何catch exception 并把从Java传入JNI的错误抛出)