Daniel Warren Daniel is a Java Developer at IDRsolutions and the product manager for FormVu. He enjoys experimenting with different computer systems, D&D, and a variety of PC games.

Are you a Java Developer working with PDF files?

Find out why you should be using JPedal

OpenJDK projects you should know about – Panama

1 min read

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:

  • Is complicated to learn
  • Has multiple possible points of failure
  • Has little room for JIT optimization
  • Requires you to also be able to program in C.

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:

  • Provide a foreign interface at the Java level similar to JNA and JNR
  • Optimize these calls at the JVM level
  • Expand the supported model to include C++ functionality
  • Make it easier for Java developers to run native code

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:

  • Using annotated interfaces to model the primitive types/objects in Java
  • Generating the implementations on the fly with binding
  • Providing us with an automated tool (JExtract) to generate the interfaces
  • Getting the compiler to produce the library directly, rather than a header file that you then have to code with

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?



Our software libraries allow you to

Convert PDF to HTML in Java
Convert PDF Forms to HTML5 in Java
Convert PDF Documents to an image in Java
Work with PDF Documents in Java
Read and Write AVIF, HEIC, WEBP and other image formats
Daniel Warren Daniel is a Java Developer at IDRsolutions and the product manager for FormVu. He enjoys experimenting with different computer systems, D&D, and a variety of PC games.

2 Replies to “OpenJDK projects you should know about – Panama”

  1. “Panama has a Java 12 early-access build which you can experiment with (curently only working on Mac and Linux)”. Please note that the latest panama early access is available for Windows as well.

  2. Good spot! Many thanks for the correction, I have updated the post. It’s nice to see the latest build is even more accessible

Comments are closed.