JNI (Java Native Interface)
Specification (Java 17)
Basically broken into three parts:
- Java calling native code (static methods marked
native
and dynamically linked at runtime)
- Native code calling back into the JVM (native code accessing fields and methods of Java objects)
- Invocation/hosting (bringing the JVM up inside a native process--which is what the
java
host does)
Helpers
- jni.hpp: a modern, type-safe, header-only, C++14 wrapper for JNI
- JavaCPP: The missing bridge between Java and native C++
- swift-jni: Swift wrappers around JNI
JNA
Source
JNR (jnr-ffi): Java Abstracted Foreign Function Layer
Java library for loading native libraries without writing JNI code by hand or using tools such as SWIG. JNR is a comparingly young project that target the same problem. Similarly as JNA or Bridj it does not require native programming. There's not much documentation or reviews at the moment, but JNR is often called promising.
Source
BridJ
Source
Project Panama
Website (OpenJDK)
- Panama: A Foreign Policy for Java
- Native Interfaces: The Phantom Menace
GraalVM
Supports native execution of LLVM bitcode using Sulong. This enables interop to C/C++, Fortran, and other languages that can be compiled to LLVM bitcode.
Other FFI
Tags:
vm
jvm
native
llvm
Last modified 22 November 2024