Java Native Interface - Purpose and Features

Purpose and Features

JNI enables one to write native methods to handle situations when an application cannot be written entirely in the Java programming language, e.g. when the standard Java class library does not support the platform-specific features or program library. It is also used to modify an existing application—written in another programming language—to be accessible to Java applications. Many of the standard library classes depend on JNI to provide functionality to the developer and the user, e.g. file I/O and sound capabilities. Including performance- and platform-sensitive API implementations in the standard library allows all Java applications to access this functionality in a safe and platform-independent manner.

The JNI framework lets a native method use Java objects in the same way that Java code uses these objects. A native method can create Java objects and then inspect and use these objects to perform its tasks. A native method can also inspect and use objects created by Java application code.

JNI is sometimes referred to as the "escape hatch" for Java developers because it enables them to add functionality to their Java application that the standard Java APIs cannot otherwise provide. It can be used to interface with code written in other languages, such as C and C++. It is also used for time-critical calculations or operations like solving complicated mathematical equations, because native code may be faster than JVM code.

Read more about this topic:  Java Native Interface

Famous quotes containing the words purpose and, purpose and/or features:

    Your good mother tells me you are feeling very badly in your new situation. Allow me to assure you it is a perfect certainty that you will, very soon, feel better—quite happy—if you only stick to the resolution you have taken to procure a military education. I am older than you, have felt badly myself, and know, what I tell you is true. Adhere to your purpose and you will soon feel as well as you ever did.
    Abraham Lincoln (1809–1865)

    Certain books seem to have been written not for the purpose that we learn something from them but that we know that the author was a knowledgeable person.
    Johann Wolfgang Von Goethe (1749–1832)

    It is a tribute to the peculiar horror of contemporary life that it makes the worst features of earlier times—the stupefaction of the masses, the obsessed and driven lives of the bourgeoisie—seem attractive by comparison.
    Christopher Lasch (b. 1932)