• 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

Calling Java from C (JNI)

 
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic