Calling main method from JNI fails

后端 未结 1 1932
醉酒成梦
醉酒成梦 2021-01-14 09:10

I created a C++ class that is supposed to call Main.main by following: http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html#wp9502.

相关标签:
1条回答
  • 2021-01-14 09:53
    jclass MainClass = env->FindClass("loader.Main");
    

    This is wrong. You have to use slashes instead of dots when using JNI functions, just like in method signatures.

    The correct code is:

    jclass MainClass = env->FindClass("loader/Main");
    
    0 讨论(0)
提交回复
热议问题