Site iconJava PDF Blog

OpenJDK projects you should know about – Panama

openjdk

This month we are focusing on OpenJDK projects you should know about. This time we will be covering Project Panama (we have also looked at Valhalla, LoomSkara and Amber).

My understanding of this project was greatly helped by Maurizio Cimadamore’s talk at Devoxx Belgium, you can watch the whole talk here.

What is Project Panama?

Project Panama is the OpenJDK project which is focused on improving Java’s support for accessing native code. Java currently provides us with Java Native Interface (JNI), however this implementation:

Because of this, the Java community has worked to make native code interactions more accessible, with libraries such as Java Native Access (JNA) and Java Native Runtime (JNR).

With this in mind, Oracle set up Project Panama. The aims are to:

Why is Panama important?

Being able to use native code can provide different benefits but normally it can be cut down to 3 reaasons:

  1. To access functionality outside of the JDK (Libraries like OpenGL for example)
  2. To gain better performance
  3. To interact with legacy code/systems

It is worth noting that if you want better performance: even if there is a good performance boost by using native code, you should take the performance cost of the interface into consideration, as it could negate any gains.

With Panama, all of the above are possible and more accessible to all Java developers. In the right circumstances, you can develop a better application for your users. You may very well find it is something you want to experiment with.

How will it do it?

Although there is the potential for the direction to change, Panama will make a more accessible method native code interface by:

Additional information:

Panama has a Java 12 early-access build which you can experiment with (now available for Mac, Linux and Windows on the latest release). The JExtract tool shows a lot of potential, I would recommend giving it a test.

If you want to follow the development of the project, you can always subscribe to the mailing list.

 

Have you used native code for your projects before? Are you looking forward to what Panama might bring?