JNI_HOWTO

Integrating native (C code) libraries into Swarmcast utilizing the Java Native Interface (JNI)


Step 1. First of all, the java code has to be compiled into a .class file.

Step 2. Then the header (.h) file has to be created, based on the compiled java class. From the directory where the class file is located, type: javah <classfilename.class>. This file will be included in the c code.

Step 3. Write and compile the C code, including the .h file above: "#include <classfilename.h>"

Step 4. Run the java code: java <classfilename>


Note: The following 2 files determine the useage of the FEC JNI code in Swarmcast.
Swarmcast/FEC/classes/lib/fec.properties turns "on" the fec native jni code.
Swarmcast/FEC/classes/lib/native-lib.properties specifies the location of the compiled c code.





Additional Information can be found at the source: http://java.sun.com/docs/books/tutorial/native1.1/index.html



--------------------------------------------------------------------------------
This file created: March 21, 2001 for OpenCola by Todd Hiltz (todd@opencola.com)