Tuesday, June 11, 2013

JNI - Java Native Interface

Java Native Interface


JNI is a standard programming interface used to solve following problems.
  1. Write Java native methods.
  2. Embedding Java Virtual Machine(JVM) into native application.

Java native Methods:

Java native methods allow programmers to write methods in some other programming languages, such as C , C++ etc. Use case for native methods are as following.
  1. Use certain system functionality that can't be done using pure java.
  2. Get performance mileage by implementing performance sensitive methods in native over pure java.
Follow the link for sample code. Native method Step by Step 

Embedding JVM into native application:

There are certain cases when we require to call existing Java methods in our native code. This is achieved by embedding JVM into our native application.

Follow the link for sample code. Embed JVM in native C code   

No comments:

Post a Comment