java - Use JNI to call C functions in host binary -
i'm trying call jni c function in executable hosting jvm. i've compiled -rdynamic, , confirmed nm -d symbol exported in dynamic symbols table. however, when call jvm complains symbol can't found. i've done in past luajit , rather trivial, i'd pretty surprised if can't done java. i created test method in class jnitest public static native int strlen(); and implementation: #include <jni.h> #include <java/com_jnitest_jnitest.h> #include <string> #include <iostream> jniexport jint jnicall java_com_jnitest_jnitest_strlen(jnienv* env, jclass clazz) { return 1111; } int main() { jnienv* env; javavm* jvm; javavminitargs args; javavmoption options[1]; args.version = jni_version_1_8; args.noptions = 1; args.options = options; args.ignoreunrecognized = false; std::string classpath = "-djava.class.path="; classpath += "/var/projects/jnitest/src/java"; options[0].op...