[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Please send email if you are having login problems - see the posts below for more info.
Hotmail and Yahoo! users - please see the Hotmail post or the Yahoo! post for information on lost emails.
JNI?  XML
Forum Index » J2EE Application Development
Author Message
harry@dayfamilyweb

Newbie

Joined: 06/30/2006 20:05:00
Messages: 2
Offline

recently Ive seen lots of java articles mentioning JNI .what is JNI? what is its purposes? how do you use JNI? is the any tutorials on JNI?

stdunbar

Newbie
[Avatar]

Joined: 06/22/2005 14:51:37
Messages: 849
Location: Superior, CO, USA
Offline

I liked the the answer you got in your crosspost.

Thanks for using the forums at hotjoe.com
[WWW] [Yahoo!] [ICQ]
harry@dayfamilyweb

Newbie

Joined: 06/30/2006 20:05:00
Messages: 2
Offline

like i told you before i almost always post on multtipule forums
stdunbar

Newbie
[Avatar]

Joined: 06/22/2005 14:51:37
Messages: 849
Location: Superior, CO, USA
Offline

Ok, well then - JNI is the Java Native Interface. It is a means of using a native (that is, O/S and platform specific) library from within Java. Java and the native library can send data structures back and forth and call methods back and forth. It is most commonly used with C and C++ programs though that is not a requirement.

By definition the use of JNI mean that your code is no longer portable as it isn't 100% Java. You would have to distribute platform specific binaries with your Java just as you would if you coded in C.

A common use is for vendors who don't really want to write in Java and have an already existing native code library. They provide a thin JNI wrapper over the native library and *poof* - they have Java support.

I wouldn't exactly consider JNI to be a "framework". It is a means of accessing some sort of platform specific behavior from Java.

Thanks for using the forums at hotjoe.com
[WWW] [Yahoo!] [ICQ]
mrider

Newbie

Joined: 10/25/2005 11:50:02
Messages: 25
Offline

A little used (so far as I know anyway), but legitimate use for JNI would be to provide a Java API to hardware. Take a look at the following post for an example of what I mean: http://forums.hotjoe.com/posts/list/274.page.

I have no personal experience to back this up, but it seems to me that with hardware like that it would be in everybody's best interest to provide the smallest native lump possible, and then provide as much portable code as possible. Code that comes with a device like that is just overhead, it's not the main order of business. If I were designing the interface for that printer (or something similar), I'd be championing Java. It only makes sense.

So from that perspective, JNI could be used in places where it's necessary to "get close to the metal".
 
Forum Index » J2EE Application Development
Go to:   
Powered by JForum 2.1.9 © JForum Team
This site run by Scott Dunbar of Xigole Systems. © 2005-2011 - Scott Dunbar
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners
hotjoe.com, xigole.com, and Scott Dunbar have no affiliation with Oracle