Javah error while using it in JNI

前端 未结 14 1670
离开以前
离开以前 2020-12-01 05:27

Command:

javah -jni JavaHowTo

Result:

error: cannot access JavaHowTo 
class file for JavaHowTo not found

javadoc: error -          


        
14条回答
  •  情深已故
    2020-12-01 05:38

    I am using Eclipse.

    Command syntax:

    javah -d  -classpath  
    

    outputdir - The directory where the header file is generated.

    classpath - Contains an absolute path to the directory containing the root package.

    fully_qualified_class - The name of the class containing native methods WITHOUT .class extension

    The following file is generated:

    C:\Users\John\workspace\JNITest\bin\com\canessa\john\jnitest\com_canessa_john_jnitest_CallMyCLib.h

    The contents of the generated header file:

    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include 
    /* Header for class com_canessa_john_jnitest_CallMyCLib */
    
    #ifndef _Included_com_canessa_john_jnitest_CallMyCLib
    #define _Included_com_canessa_john_jnitest_CallMyCLib
    #ifdef __cplusplus
    extern "C" {
    #endif
    /*
     * Class:     com_canessa_john_jnitest_CallMyCLib
     * Method:    helloInC
     * Signature: ()V
     */
    JNIEXPORT void JNICALL Java_com_canessa_john_jnitest_CallMyCLib_helloInC
      (JNIEnv *, jobject);
    
    #ifdef __cplusplus
    }
    #endif
    #endif
    

提交回复
热议问题