Staff Writer

Project Panama's FFM API: A New Dawn for Java-Native Interfacing

The Java ecosystem is on the brink of a transformative change. Project Panama, encompassing the Foreign Function and Memory (FFM) API, is gearing up to transition from its preview phase in the imminent JDK 22. This new development aims to improve the manner in which Java interfaces with native libraries, presenting a more streamlined, efficient, and safer counterpart to the longstanding Java Native Interface (JNI). The significance of this transition cannot be overstated, as it promises to redefine the Java-native interface landscape.

The Java Native Interface (JNI) has been the go-to for Java to interact with native code, but it comes with challenges. Its complexity demands expertise in both Java and native programming, often leading to error-prone "glue" code. Performance can suffer due to the overhead of frequent JNI calls. Memory management is manual, risking leaks or crashes, and direct memory access poses safety concerns. Developers grapple with verbose boilerplate code, tricky error handling, and potential version compatibility issues. Recognizing these challenges, the Java community has been eagerly awaiting updates on Project Panama's FFM API.

Maurizio Cimadamore, a key figure in the development of the FFM API, recently provided insights into the API's journey and its anticipated full release in JDK 22. Reflecting on the API's evolution, Cimadamore says, "We now believe the FFM API is largely stable, and we have started accumulating some changes in the Panama repository that aim at polishing some minor edges in the API". The FFM API, having undergone rigorous refinement since its debut in Java 19 and subsequent re-previews in versions 20 and 21, has seen pivotal enhancements. These include streamlined memory management, enhanced safety measures, and the introduction of customization features.

The Java community has been buzzing with excitement and anticipation following Maurizio's summer update on the FFM API. One Redditor exclaimed, "This is huge for using Java with other libraries. JNI has been a yoke around its neck for ages". Another user delved into the practical applications of the FFM API, highlighting its utility for those working with bytes/buffers in various domains such as games, images, videos, and more.

Project Panama aims to bridge the Java Virtual Machine (JVM) with non-Java APIs, commonly utilized by C developers. This endeavor will encompass various components, including the ability to call native functions from the JVM, access native data either from the JVM or within its heap, and introduce new data layouts within the JVM heap. Additionally, Project Panama is set to provide tools for extracting API details from header files (jextract), manage native libraries, and offer native-centric interpreter and runtime mechanisms.

The Hotspot Group sponsors this initiative, and the community can stay updated on its progress through various mailing lists and news channels. For those interested in the technical details, design documents are available, covering topics like foreign memory access, foreign function support, and usage examples for jextract.

As Java continues to evolve, tools like the FFM API under Project Panama signify its commitment to innovation, efficiency, and developer needs. The Java community, with bated breath, looks forward to the transformative changes JDK 22 promises to bring.

Have questions or comments about this article? Reach out to us here.

Banner Image Credits: Attendees at Great International Developer Summit

See Highlights

Hear What Attendees Say


“Once again Saltmarch has knocked it out of the park with interesting speakers, engaging content and challenging ideas. No jetlag fog at all, which counts for how interesting the whole thing was."

Cybersecurity Lead, PwC


“Very much looking forward to next year. I will be keeping my eye out for the date so I can make sure I lock it in my calendar."

Software Engineering Specialist, Intuit


“Best conference I have ever been to with lots of insights and information on next generation technologies and those that are the need of the hour."

Software Architect, GroupOn

Hear What Speakers & Sponsors Say

Scott Davis

“Happy to meet everyone who came from near and far. Glad to know you've discovered some great lessons here, and glad you joined us for all the discoveries great and small."

Web Architect & Principal Engineer, Scott Davis

Dr. Venkat Subramaniam

“Wonderful set of conferences, well organized, fantastic speakers, and an amazingly interactive set of audience. Thanks for having me at the events!"

Founder of Agile Developer Inc., Dr. Venkat Subramaniam

Oracle Corp.

“What a buzz! The events have been instrumental in bringing the whole software community together. There has been something for everyone from developers to architects to business to vendors. Thanks everyone!"

Voltaire Yap, Global Events Manager, Oracle Corp.