• 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

jni methos in c++ class

 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

I have a silly doubt, but it is worth so much for my project.

Is it possible to declare jni methods in c++ class...

till now i have jni with no c++ class

example

this is the java class



this is the c++ code. it has no class



these (JNIEXPORT jint JNICALL Java_testin_Mod) are from the header file created from the java file...

now i have c++ class and i need jni to be integrated to some of the methods of that class. but it is thowing error from the java class where i call the c++ method...


any help please..

thanks in advance

 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you compiled the C++ file as a DLL file? Is that DLL file called test.dll? Is that DLL file in a folder in the java.library.path?
 
bharani rao
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
rob,

i'm workin in linux.
i created the so file..
placed that in /usr/lib<something> folder

when running i get these errors because there is a class in c++...

it is working fine if i place that JNIEXPORT etc., outside the class.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic