Unable to generate JNI.c file using javah -stubs

I am trying to create JNI code from my Java class. I was able to generate the header without problems using javah. Whenever I run javah with the -stubs command, I get this error:

Error: JNI does not require stubs; refer to the JNI documentation.

Does anyone know if there is a way to create a JNI .c file for the class. I can make the file from my header manually, but this is similar to what the tool should do.

I have found an unresolved error request about this since 2000, so I don’t hope too much. http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4368114

+4
source share
1 answer

-stubs is the remainder of the long-obsolete first cut in JNI. This has never created anything useful for any version of Java used in this century.

Just copy the header file to your .c file and add the function body to each function.

Or maybe take a look at http://jna.java.net/ .

+3
source

Source: https://habr.com/ru/post/1344972/


All Articles