Java Native Extensions (JANET): generate Java-to-C and Java-to-C++ bindings with ease

View the Project on GitHub dejwk/janet

What is JANET good for?

JANET allows you to use arbitrary native code C and C++ libraries in your Java applications, without the hassle that comes with Java Native Interface (JNI) or Swig. If you have ever used JNI or Swig, you know how error-prone and complex they can be. JANET, on the other hand, allows you to embed native code directly in your Java files. From that native code, you can access Java fields, call Java methods, throw Java exceptions, synchronize on Java monitors, and do pretty much anything else that you can normally do via JNI. Unlike JNI, however, you do all that using the familiar Java syntax. JANET then does the hard work of generating JNI interface code for you, taking care of hairy issues such as resolving signatures and references, checking for exceptions, converting strings, pinning arrays, reference counting, etc.


JANET is a free, open source tool distributed according to the terms of the MPL/LGPL/GPL tri-license.

Files generated by JANET translator (on the basis of your input files) are not covered by the open source license, and are yours to use. I only ask that you acknowledge the use of JANET in your documentation.


JANET has originated as my Master's thesis project in the Institute of Computer Science at UMM University, Kraków, Poland. I developed it further during my research scholarship at Emory University, Atlanta.

I wish to thank:

JANET parsers were created using the parser generator for Java, written by Dennis Heimbigner. The JB itself depends on GNU bison, and Jonathan Payne's regular expression package.

-- Dawid Kurzyniec