Java Native Interface

Java applications can call functions from external libraries.

  • Libraries can be implemented in Java, and packaged as classes.

  • Libraries can also be implemented in any other language.

    • Providing that an interface allows serialization and name resolution.

Java Native Interface allows the definition of Java methods, whose implementation is present in native code.

  • When a method is invoked, the objects are serialized, the respective native symbol is loaded and the code is executed.

  • There is a penalty due to serialization and a performance boost due to native code execution.

Standard mechanism for Java (not specific for Android).

Last updated