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:

    With the breakdown of the traditional institutions which convey values, more of the burdens and responsibility for transmitting values fall upon parental shoulders, and it is getting harder all the time both to embody the virtues we hope to teach our children and to find for ourselves the ideals and values that will give our own lives purpose and direction.
    Neil Kurshan (20th century)

    I have no purpose to introduce political and social equality between the white and black races. There is a physical difference between the two, which, in my judgement, will probably for ever forbid their living together upon the footing of perfect equality; and inasmuch as it becomes a necessity that there must be a difference, I ... am in favour of the race to which I belong having the superior position.
    Abraham Lincoln (1809–1865)

    However much we may differ in the choice of the measures which should guide the administration of the government, there can be but little doubt in the minds of those who are really friendly to the republican features of our system that one of its most important securities consists in the separation of the legislative and executive powers at the same time that each is acknowledged to be supreme, in the will of the people constitutionally expressed.
    Andrew Jackson (1767–1845)