Home > Tutorials > The Foreign Function and Memory API
These tutorials help with understanding the Foreign Function and Memory (FFM) API capabilities to invoke code outside the JVM (foreign functions) and to safely access memory not managed by the JVM (foreign memory). The FFM API facilitates Java applications to call native libraries and process native data without the brittleness and danger of JNI.
Learn how to access off-heap or on-heap memory with the Foreign Function and Memory (FFM) API through MemorySegment and Arenas.
Find out how to call a C library function from Java.
Discover how to access a C structure with MemoryLayout and further slice memory segments.
Pass Java code as a function pointer to a foreign function.
Invoke foreign functions that return pointers and check for potential errors.
Run jextract and use the generated Java bindings to integrate native libraries in your application.