Monday, August 6, 2012

Eclipse JNI Builder to build JNI header for Android


  1. Open properties window for android project.
  2. Select "Builder" menu, click "New" button for creating new builder
  3. Under "choose configuration type", select 'Program', assume Java JDK classpath is correctly set.
  4. Name the builder as "JNI-Builder".
  5. For "Location", select the javah program, my case is "/usr/bin/javah"
  6. For "Working Directory", select the 'jni' dir for android project, my case is <project>/jni
  7. For "Arguments", -classpath /path/to/android/project/bin/classes <native class name>
  8. Apply, OK.
  9. The header will build & place under the jni folder.