How to use Javah to generate a C + + header file is not found ' XX. Xxxx. Xx. CLASSNAME ' 's class file

Source: Internet
Author: User

PS: In the recent use of JNI, a write Java a will write C + + feel really annoying. Then in the use of Javah, encountered a little bit of a problem, share to everyone.

Javah is a great tool for generating a C + + file with a. class file that contains the JNI stubs for all local methods in the Java code, that is, those methods that are defined as native. If you are using a JNI stub for a class, and you have defined the class as part of the package, you must fully qualify the name of the class. Feel javah like an anti-compilation tool. Well, that's it.


For example, I was writing a Java file with Eclipse, and then the eclipse compiler generated A. class file in the bin directory, so I decided to enter my folder, Xx/xxxx/xxx inside My. class file, so I followed the instructions, Javah -jni XX.XXXX.XX. Class name, and he prompts me to not find the class file for 'XX.XXXX.XX. Class name '. :


Then exit to the Bin directory, re-enter that command, get the same answer!

Depressed how to solve, and then find the answer, the first to ensure that the directory is the Java package on the upper-level path, if it is the eclipse compiled, then is in the Bin directory, the use of instructions

Javah-classpath. Xx. Xxxx.xxx. CLASSNAME

It's ready!! Note the middle of a separate decimal point! Then you can get the. h file you generated!!





How to use Javah to generate a C + + header file is not found ' XX. Xxxx. Xx. CLASSNAME ' class file

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.