• Post Reply Bookmark Topic Watch Topic
  • New Topic

Call method using JNI  RSS feed

 
bharani rao
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i've created jni for a c++ program.

i wanted to call the c++ method in java and called it succesfully( i mean i have created a .h file which has the c++ header like JNIEXPORT etc.,)

i replaced the header or what ever is present in .h file created by java -jni <file name> in c++

but i get following error




i get the first error when i replace the method declaration with the following,
JNIEXPORT void JNICALL Java_phone_pjstart (JNIEnv *env, jobject ob)
and in the main method i call it as obj.pjstart()

i get the second error when in main method i put
obj.Java_phone_pjstart()

remember obj is the object of main class and not that is in (JNIEnv *env, jobject ob)



any suggestions

thanks in advance







 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You seem to be having problems calling C++ methods from other C++ methods; this isn't really a Java question, although the code is dealing with the JNI header files: it's just a C++ question. I am not sure why you think you can change the names of the methods (you can't) or leave out the arguments when you call a method (you can't.) Just as in all C++ code, just as in all Java code, you have to call the methods that are there, using the arguments that they require. I don't know what else to tell you.
 
bharani rao
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!