Programming languagesTools-in-Action25min
Moving the seam between Java and Native code with jextract.
This session introduces jextract, a tool that automates Java binding generation from C headers via the FFM API, simplifying native integration for Java applications. Demos cover practical use cases like machine learning and GPU computing, illustrating how jextract streamlines access to native libraries without manual, error-prone coding.
Nizar BenallaOracle
talkDetail.whenAndWhere
Thursday, November 13, 11:55-12:20
Mimosa 2
Java applications often need integration with native libraries to access specialized functionality such as Off-CPU computing, graphics processing, machine learning frameworks, or System level APIs. While the Java ecosystem provides numerous powerful libraries, there exist numerous robust, native-only libraries that are not, will not and should not be rewritten in Java. Java's Foreign Function & Memory (FFM) API, finalized in JDK 22, enables Java developers to interface safely and efficiently with native code.
However, creating Java bindings manually using the FFM tedious and error-prone, as one would need to know the layouts of all the native types involved. jextract addresses this challenge by automatically generating Java bindings from existing C headers.
The session briefly illustrates the types of bindings generated by jextract for common C constructs such as structs, nested structs, functions, variadic functions, typedefs, built-in types, and the recommended workflow. It also includes live demos where Java client code uses jextract-generated FFM bindings to interact with native libraries, such as running machine learning inference using ONNXRuntime-genAI and performing GPU-accelerated CUDA nbody simulations using a fully jextracted OpenCL and OpenGL backend.
Participants will leave understanding how jextract allows developers to ""move the seam" between Java and native code.
However, creating Java bindings manually using the FFM tedious and error-prone, as one would need to know the layouts of all the native types involved. jextract addresses this challenge by automatically generating Java bindings from existing C headers.
The session briefly illustrates the types of bindings generated by jextract for common C constructs such as structs, nested structs, functions, variadic functions, typedefs, built-in types, and the recommended workflow. It also includes live demos where Java client code uses jextract-generated FFM bindings to interact with native libraries, such as running machine learning inference using ONNXRuntime-genAI and performing GPU-accelerated CUDA nbody simulations using a fully jextracted OpenCL and OpenGL backend.
Participants will leave understanding how jextract allows developers to ""move the seam" between Java and native code.
Nizar Benalla
Nizar Benalla is a Software Engineer in Oracle's Java Platform Group, where he helps evolve the tooling around the Java Language, most notably the Java documentation tool (javadoc), the Java Bindings generator (jextract) and the API comparison tool (apidiff) under the OpenJDK project.
comments.speakerNotEnabledComments