2012年5月16日 星期三

jni and javah

1. javah usage:

    type this command:
javah -jni com.XXX.XXX.className
    It will generate a .h file. Using this .h file, we can start to edit the corresponding .cpp file.


2. JNI unsatisfied link error

    When writing JNI programs, sometimes we see this errors. It is hard and troublesome to find which part of the code actually went wrong. My experience is to check the following:

  • check .h and .cpp files, and see if they are consistent.
  • focus on the parameters passed from java side. Check if the parameter type and number of those parameters are the same.
  • Check the function name in .h/.cpp files. It should be like this:

Java_packageName_className_functionName()




沒有留言:

張貼留言