• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java Native Interface

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
May I know what is Java Native Interface? Is it a package? If yes how do I import the package? Are there any methods that I can use? If com2 port is already windows settings for use with the mouse, what connectors behind the PC can I still use to control hardware?
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Java Native Interface isn't a package, it's more like a specification. It describes a technique for allowing the JVM to connect a Java method call to some C/C++ library code on the local system.
The reserved word native, when used in a method declaration, tells the JVM that the method outsources its execution to some shared object library (.so file in Unix) or dynamic link library (DLL) in Windows.
The Java side might look like this:
The JDK provides a tool, javah, that will read the .class file and produce a C-style header file. The header declares the function prototypes used to write the C code and then create the .so or .dll file from it.
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you might want to check out "Thinking in Java" one of the appendixes gives examples of using JNI http://www.bruceeckel.com
 
John Chong
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Man, this is sounding like a song that Harry Belafonte did at Carnegi with Odetta but I can't remember the name exactly. It's either "Dear Liza" or "My bucket's got a hole" or something to that effect. In any, Belafonte sings something about my bucket has a hole in it, what shall I do? Liza replies: "Fix it!Dear Henry etc. where upon he replies "How do I fix it?". Everytime she gives him an answer he asks another question. The song goes one stanza after another and it's funny. But this isn't.
 
Michael Ernest
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh. Well, ok: JNI is something you use to make Java code work with C code.
 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chong,
The song goes like this.
There's a hole in the bucket dear Liza, dear Liza , dear Liza.
Then fix it dear Henry, dear Henry, dear Henry.
With what shall I fix it dear Liza, dear Liza , dear Liza ?
With straw dear Henry, dear Henry, dear Henry.
But the straw is too long dear Liza, dear Liza , dear Liza.
Then cut it dear Henry, dear Henry, dear Henry.
With what shall I cut it dear Liza, dear Liza , dear Liza.
With a knife dear Henry, dear Henry, dear Henry.
But the knife is too blunt dear Liza, dear Liza , dear Liza.
Then whet it dear Henry, dear Henry, dear Henry.
With what shall I whet it dear Liza, dear Liza , dear Liza.
With a stone dear Henry, dear Henry, dear Henry.
But the stone is too dry dear Liza, dear Liza , dear Liza.
Then wet it dear Henry, dear Henry, dear Henry.
Whith what shall I wet it dear Liza, dear Liza , dear Liza.
With water dear Henry, dear Henry, dear Henry.
How do I fetch water dear Liza, dear Liza , dear Liza.
In a bucket dear Henry, dear Henry, dear Henry.
But there is a hole in the bucket dear Liza, dear Liza , dear Liza.
Its more than thirty years since I sang this song on speech day at my boarding school. I hope I have got the words more or less right. Pretty awesome memory, if I may say so myself. Eh Chong?
Cheers
Sahir
[This message has been edited by Sahir Shah (edited March 21, 2001).]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic