Project Panama builds a bridge between Java and C/C++

Project Panama would provide a native interconnect between code managed by the JVM and APIs for non-Java libraries

Advocates of open source Java are moving forward with an effort to let Java programmers access non-Java APIs, including many interfaces used by C programmers.

Called Project Panama, the proposal is being floated on an opnjdk open-source Java mailing list and picking up support. "The main benefit of this proposal is that it will open up the world of native libraries -- written in C or similar languages -- to Java developers without requiring them to write anything but plain Java code," said Panama proponent Charles Nutter, who co-led the development of the JRuby language. "You just specify what library to load, what function you want to access, and its parameters and return value and the API should do the rest."

The project is intended to provide for native interconnect between code managed by the JVM and APIs for libraries not managed by the JVM. The challenge will be making the API flexible enough to handle a range of native library types, including C, C++, Windows, Linux, and Solaris, without making the API too difficult to use, said Nutter, who works as a principal software engineer at Red Hat. Good tools will be needed for generating Java code for binding libraries, to accommodate subtle, platform-specific differences, he added.

Project Panama provides an alternative to JNI (Java Native Interface) for interfacing Java code to code written in unmanaged languages, said Forrester analyst John Rymer. "It seems to be in line with the current emphasis on APIs. In this case, folks who write in C/C++ can provide API access to their applications for Java code."

The proposal, he said, describes technical mechanisms and conventions required for this to work. JNI serves as a Java intermediary that other languages can use to expose an API to Java code, Rymer noted. "The way I read the Project Panama proposal, the team will seek a more streamlined intermediary -- perhaps direct calls. We'll have to see how this all works out."