• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Native Interface

 
Jay Damon
Ranch Hand
Posts: 282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just started looking at the JNI API. I wanted to access a native Windows function. However, it appears that I cannot call that function directly; I must create an "intermediate" program or DLL to mediate the call. It further appears that the methods created in the intermediate program and package- and class-dependent. Is my understanding correct?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes -- and no!
Since it's possible to call functions in a DLL by name, dynamically (just as you can call Java functions using reflection), it's possible to write a single set of JNI functions which allow you to call any function in a DLL by name. There are commercial products that do precisely this for the Win32 API. I'm not aware of a free version.
But in the general case, yes, you write a JNI function to implement a specific Java method in a specific way.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!