Search code examples
androidc++candroid-ndkjavah

Include Android platform jars when using javah tool


How to include jar files of the Android platform when using the javah tool to create a C/C++ .h header file ???


Solution

  • Assuming:

    1. your android SDK is installed in C:\android\sdk (and you have downloaded Android 1.5 platform)
    2. your android NDK is installed in C:\android\ndk

    Open command line window. Go to C:\android\ndk\samples\hello-jni folder. And execute the following:

    javah -classpath C:\android\sdk\platforms\android-3;src com.example.hellojni.HelloJni
    

    It will generate com_example_hellojni_HelloJni.h file with JNI functions for hello-jni example from Android NDK.