It seems to me that you have already written a script, it just needs a few modifications:
Windows
myscript.cmd
@ECHO OFF setlocal SET SDK_ROOT=C:\PROGRA~2\Android\android-sdk\ SET NDK_ROOT=C:\PROGRA~2\android-ndk-r6b\ CD Android/bin/ javah -d ../../test/mytest/ -classpath .:%SDK_ROOT%/platforms/android-8/android.jar com.test.MyTest CD .. RUN %NDK_ROOT%/ndk-build endlocal
Unix
myscript.sh
#!/bin/bash SDK_ROOT="/cygdrive/C/PROGRA~2/Android/android-sdk/" NDK_ROOT="/cygdrive/C/PROGRA~2/android-ndk-r6b" cd Android/bin/ javah -d ../../test/mytest/ -classpath .:${SDK_ROOT}/platforms/android-8/android.jar com.test.MyTest cd .. $NDK_ROOT/ndk-build
Also, make sure javah exists in the env PATH variable.
if it does not exist, you can add it to the scripts at the beginning:
Windows
SET PATH=c:\path\to\javah;%PATH%
Unix
export PATH=/path/to/javah:$PATH
Note. You may need to change the sdk / ndk paths for the script in windows.
source share