Android JNI development generates. h header File issues

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.