Advantages and disadvantages of using JNI?

Advantages of JNI:

1. JNI enables one to write programs in native language or method when an application cannot be written entirely in the Java programming language.
2. It is also used to modify an existing application which is written in another programming language so that it can be accessible to Java applications.
3. It allows all Java applications to access performance- and platform-sensitive API implementations functionality in a safe and platform-independent manner.
4. JNI helps to address the interoperability issues.

Disadvantages of JNI:

1. An application that relies on JNI loses the platform portability that Java offers.
2. The JNI framework does not provide any automatic garbage collection for non-JVM memory resources allocated by code executing on the native side.
3. Error checking is a must or it has the potential to crash the JNI side and the JVM.
4. Difficult to debug runtime error in native code.


Popular posts from this blog

Bluetooth Data Transfer Example

DeCompile .apk file on ubuntu 14.04