Results 1 to 3 of 3

Thread: Help with JNI

  1. #1
    Daniel is offline Member
    Join Date
    Jun 2007
    Posts
    91
    Rep Power
    0

    Default Help with JNI

    recently I have 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?

    Thanks.

    Daniel:o

  2. #2
    Eric is offline Senior Member
    Join Date
    Jun 2007
    Posts
    111
    Rep Power
    0

    Default

    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.

    Greetings.

    Eric

  3. #3
    Albert is offline Senior Member
    Join Date
    Jun 2007
    Posts
    114
    Rep Power
    0

    Default

    A little used, but legitimate use for JNI would be to provide a Java API to hardware.

    I have no personal experience to back this up, but it seems to me that with hardware like that it would be in everybody 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.

    Greetings.

    Albert:rolleyes:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •