Invoking native methods using JNI

Hi,
How can I invoke a C/C++ methods using JNI. Has anyone worked on JNI. What are the steps to be followed when you are writing a JNI?

Rgds.

You might get good info in a Java forum…

Hi Rob,
I am trying to invoke a java service with a JNI interface in the Developer in order to use a C/C++ API which is from a third party and there is no vendor supplied JNI with it.

I have the stpes to write a JNI as mentioned in this URL which is the Java way of doing it. But please let me know how to go about doing the same in WM services. THe URL is “[COLOR=navy][FONT=Arial]JNI programming

Thanks
:confused:

Review the Developer Users Guide, Chapter 12, Building Services Using C/C++. It provides the information needed to make JNI calls.

Hi Rob,
I have gone through the pdf. but I am not clear on how to incorporate a third party C/C++ API into the WM environment. Greatly appreciate your help on this.

Regards,
Percy

Is there a specific question you have? The docs talk about where to put the third party library and how to create the Java code necessary to interact with the calls exposed by that library.

Hi Rob,
I see that the Chapter 12 of the Developer User Guide describes the way Developer handles the C/C++ services. i.e

  1. create a specification giving the input/output
  2. create a C service by clicking on File->New->C service…so on.
  3. then Developer creates three files i.e. java file, .c file and the make file.
  4. now we are supposed to customize the implementation for the c service.

But my problem is I already have the collection of the C services and the DLL files as well. Can you please let me know the steps i need to take to invoke these services. Or let me know if I am missing any information in the pdf file.

Thanks n Regards,
Percy

You can run through those steps listed in the document to see the Java code that gets generated. With that information, you can create your own Java code that calls the functions/methods in your existing DLL. The information in the doc identifies where to place the DLL.