What is JNI?
JNI stands for Java Native Interface, a software framework that allows codes written in Java and running under JVM (Java Virtual Machine) to work with other software or applications that are based and/or written using a different computer language. Sometimes it becomes necessary for a programmer to use JNI when a particular computer application cannot be created alone using the Java language in its entirety. This is what happens when Java’s standard class library cannot directly communicate with the program libraries of other software that may be platform-specific. Software that is written in C language for example may need to work or invoke JNI via Java applets in order for it to work or function efficiently. The Java Native Interface may also be invoked or called by other libraries that are written in other languages.
JNI is basically used as a modification tool for program writers and developers. With JNI, existing applications that are written by another program may be edited and re-configured for them to interact and communicate efficiently with Java-based programs and software. A typical example of this setup involves standard library classes. These libraries need to work with JNI in order to make them functional to both the computer developer and the end-user. Because of this ability and feature, Java Native Interface is widely used by Java programmers to increase functionality to Java-based applications. With a means to make Java-based applications compatible with other applications written using other languages, functionality is increased.
JNI also has its disadvantages though. It is said that when an error occurs using JNI, the whole Java Virtual Machine environment may be compromised and these types of errors result to debugging concerns on the developers. This simply means that error-checking is an essential step that must be taken by developers so as not to disadvantage the whole JVM environment. Reliance on JNI also results to the loss of platform portability for Java-based applications.