Disadvantages of using Java Native Interface

前端 未结 6 1120
南旧
南旧 2020-12-29 13:46

I can not get these two disadvantages of using JNI. I want to know more about them:

  • Difficult to debug runtime error in native code

  • Errors i

6条回答
  •  独厮守ぢ
    2020-12-29 14:14

    Difficult to debug runtime error in native code

    Have you ever seen a stacktrace in Java? Well they are very user friendly and they tell you most of the times, the line number, class method and what failed. You don't have those on Native code.

    Errors in JNI code take down the entire JVM and don't provide any mechanism for graceful recovery

    When you run java code, all is run under the control of the JVM, if something goes wrong, the JVM can handle it. You don't have that control using Native code.

提交回复
热议问题