JNI

Isn’t too bad, thanks to Sun’s Tutorial. Also take note of Apache Ant’s javah task.

I did my development on Debian Linux, while the tutorial targets Solaris, Windows, and OS X. This was only a problem for creating the shared library. Here are the compilation and link commands I used, respectively:

gcc -g -Wall -I/usr/local/java/include/ -I/usr/local/java/include/linux -c HelloWorldImp.c
gcc -shared -Wl,-soname,libhello.so -o libhello.so HelloWorldImp.o -lc

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s