In the JNI development, the first to build the Anroid class compiled into a. h file, compiled with the command Javah, because the first use, the previous Java compilation process is not familiar with, so went a lot of detours, the network does not have a detailed introduction to this step, here to talk about:
Execution via DOS command, (1) Start-"run-" cmd-> into DOS command operator interface
Enter Javah-classpath bin\classes-d jni com.sirc.jni.HelloWorld on the command line
You can see the following results by entering Javah:
Usage: javah [options] < classes >
Where [options] include:
-help output this help message and exit
-classpath < paths > paths for loading classes
-bootclasspath < paths > paths for loading the boot class
-D < directory > output directory
-o < file > output file (only one in-D or-O is used)
-jni generating JNI-styled header files (default)
-version Output Version Information
-verbose Enable verbose output
-force always write to output file
This indicates that-classpath is used to load the classpath of the class, and we have already entered the root path of the item D:\workspace\ar\jnitest directory, so-classpath just loads the Helloworld.class class file bin\ Classes directory,-D is used to specify the output path, generally under the project root path to create a new JNI folder to store c files, so-D after the input JNI, and finally registration + class name
After execution, you can see the production. h header file Com_sirc_jni_helloworld.h below the Jni folder, and the build succeeds.
Note: The path must correspond to correct, I have just started to enter a problem, no words can be directly input full path:
Javah-classpath D:\workspace\ar\jnitest\bin\classes-d JNI Com.sirc.jni.HelloWorld
But I used to prompt javah is not an internal program or external program, the original is the environment variables in the JDK parameters dropped, reset
Path added: C:\Program Files (x86) \java\jdk1.6.0_18\bin; C:\Program Files (x86) \java\jre6\bin
Classpath new or added: C:\Program Files (x86) \java\jdk1.6.0_18\lib\dt.jar; C:\Program Files (x86) \java\jdk1.6.0_18\lib\tools.jar
Java_home NEW: C:\Program Files (x86) \java\jdk1.6.0_18
Transferred from: http://www.cnblogs.com/gisdream/p/3521090.html
Android JNI development generates. h header file problem (GO)