IT Community - Software Programming, Web Development and Technical Support

What means by Java Native Interface?Benifits of its

This is a discussion on What means by Java Native Interface?Benifits of its within the Java Programming forums, part of the Software Development category; Hi, What means by Java Native Interface?Benifits of its Thanks, Prasath.K...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > Java Programming

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 07-19-2007, 03:58 AM
prasath prasath is offline
D-Web Sr.Programmer
 
Join Date: Jul 2007
Location: Chennai
Posts: 173
prasath is on a distinguished road
Default What means by Java Native Interface?Benifits of its

Hi,
What means by Java Native Interface?Benifits of its

Thanks,
Prasath.K
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 07-19-2007, 04:04 AM
senthilkannan senthilkannan is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 321
senthilkannan is on a distinguished road
Default Re: What means by Java Native Interface?Benifits of its

The Java Native Interface (JNI) is a programming framework that allows Java code running in the Java virtual machine (VM) to call and be called by native applications (programs specific to a hardware and operating system platform) and libraries written in other languages, such as C, C++ and assembly.

The JNI is used to write native methods to handle situations when an application cannot be written entirely in the Java programming language such as 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 the JNI to provide functionality to the developer and the user, e.g. I/O file reading 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. Before resorting to using the JNI, developers should make sure the functionality is not already provided in the standard libraries.

The JNI framework lets a native method utilize 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 valve" for Java developers because it allows them to add functionality to their Java Application that the Java API can't provide. It can be used to interface with code written in other languages, like C++. It is also used for time-critical calculations or operations like solving complicated mathematical equations, since native code can potentially be faster than JVM code.

The JNI is not trivial and requires a considerable effort to learn, and some people recommend that only advanced programmers should use the JNI. However, the capability for Java to communicate with C++ and assembly removes any limitations on what function Java programs can perform. Programmers considering using the JNI should be aware that

as mentioned before, the JNI is not an easy API to learn;
only applications and signed applets can invoke the JNI;
an application that relies on JNI loses the platform portability Java offers (a workaround is to write a separate implementation of the JNI code for each platform and have Java detect the Operating System and load the correct one at runtime);
there is no garbage collection for the JNI side (JNI code must do explicit deallocation);
error checking is a MUST or it has the potential to crash the JNI side and the JVM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
class and interface in java gkumar HTML, CSS and Javascript Coding Techniques 0 07-19-2009 07:10 PM
Const means? jeyaprakash.c C and C++ Programming 3 11-24-2007 06:30 AM
How do I call the native API from Java? oxygen Java Programming 2 08-06-2007 07:43 AM
Do we have interface to schedule a task like ITaskscheduler interface for desktop.... theone Mobile Software Development 1 07-24-2007 10:29 PM
Java:Tutorial - Adding Buttons to your Interface pranky Java Programming 0 02-23-2007 09:11 AM


All times are GMT -7. The time now is 12:32 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
Stamford Dentist | Euro Millions Lottery | Tech Support Services

SEO by vBSEO 3.0.0