adapt to JNI