Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Calling Java from C (JNI)

 
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 ]
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic