Step By Step |
In addition to the.h
file that you generated in the previous step, you must also usejavah
to generate a stubs file. The stubs file contains native language code that provides the glue that holds the Java class and its parallel native language structure together.To generate a stubs file use the
javah
-stubs
option. Again remember to runjavah
on the Java class.By default,
javah
will place the resulting stubs file in the same directory as the.class
file. You can use the-d
option to forcejavah
to put the generated stubs file in a different directory.Similar to the
.h
file thatjavah
generates, the name of the stubs file is the class name with.c
appended to the end. In the "Hello World!" example that you've been working with throughout this lesson, the stubs file is calledHelloWorld.c
.For the moment, all you really need to know about the stubs file is that you will later compile it into the shared library that you create in Step 6: Create a Shared Library.
Step By Step |