• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling Java from C (JNI)

 
Matt Senecal
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a java class that contains a method I need to make accessable to C functions. It looks something like this:

Using javah I have my ExportName.h, and I'm in the process of writing ExportName.c:

I have 2 questions:
(1)At some point, I need to actually call the java method using

What type should I use here (CallWhatMethod)?
(2)Also, I need to create genuine C wrappers for these methods. How do I hand off the jstring returned by this JNI C code to the ANSI C method that calls it? I know that there is a conversion along the lines of:

Can I just put the call to the JNI code where the jstring variable name goes?
Any help would be appreciated. I have already read the Java tutorial on JNI, so please don't respond just to tell me to go there.
Thanks!
[ May 13, 2002: Message edited by: Matt Senecal ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic