Notice: MediaWiki has been updated. Report any rough edges to

Java JNA Wrapper

From OpenKinect
Revision as of 22:06, 17 December 2010 by Yoda (talk | contribs) (started JNA wrapper page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Effort to create a Java JNA (Java Native Access) wrapper for libfreenect.


JNA provides Java programs easy access to native shared libraries. See

Who is involved

Coordinator/Development: Mark Renouf

Current Status



RedHat/Fedora Linux

These are command line instructions and don't make many assumptions about configuration Java class paths or native library paths. Since only only JAR (jna.jar) and one native library (libfreenect) are needed, we assume that you'll put a copy of each in a relative path directory. This could be made even simpler if your classpath and library environment variables are properly tuned, but this approach should work they are not.

1. Install libfreenect based RedHat/Fedora instructions here: Until JNA code has been merged into you'll need to work with the java-updates branch of tweakt's fork:

$ git clone
$ cd libfreenect
$ git checkout java-updates

Note that you probably don't have to go beyond the "clone the repository" step, but probably a good idea to make sure that glview is working before proceeding.
2. Move to the Java wrapper directory:

$ cd ./wrappers/java/

3. Make a ./lib directory and a ./jars directory
4. Download jna.jar into ./jars (available from
5. Copy the libfreenect library (e.g. into ./lib
6. Build the libfreenect JNA jar:

$ rm -r ./tmpjar
$ mkdir ./tmpjar
$ javac -d ./tmpjar -classpath ./jars/jna.jar ./src/main/java/org/openkinect/freenect/*.java
$ jar -cvf ./jars/freenect-jna.jar -C tmpjar org
$ rm -r ./tmpjar



Sample Code