Oracle Releases Java 16
As of March 16, Oracle’s Java Development Kit or JDK 16 is available as a production release. We will be discussing here the Java 16 new features in this article.
JDK 16 is the reference implementation of oracle’s Java 16, the standard Java version that replaces JDK 15, which was released on September 15, 2020. JDK 16 is a feature release with only six months of Oracle support.
Java 16’s release brought in new features as well as a significant improvement on the existing ones. In this article, we will take a look at them.
New Features of Java 16
Let’s take a look at the new features of Java 16.
Language Enhancements
Java 16 now permits the use of 14 capabilities of C++ in JDK C++ source code, as well as provides specific guidance on which of these features may be used in HotSpot VM code. Language features used by C++ code in the JDK were limited to the C++98/03 language standards until JDK 15.
The source code for JDK 11 has been updated to support compiling with newer versions of the C++ standard. This includes the ability to use recent compiler versions that support C++ 11/14 language features when developing.
This new version makes no style changes or uses C++ code outside of the HotSpot. However, depending on the platform compiler, some build-time changes are required to take advantage of C++ language features.
Java Now Runs on More Platforms, Thanks to New Ports
Alpine Linux Port
On the x64 and AArch64 architectures, the JDK is being ported to Alpine Linux and other Linux distributions that use musl as their primary C library. Musl is a Linux implementation of the ISO C and Posix standards for standard library functionality.
Because of its small image size, Alpine Linux is popular in cloud deployments, microservices, and container environments. For Linux, a Docker image is less than 6MB in size.
Allowing Java to run out-of-the-box in these environments will allow Tomcat, Jetty, Spring, and other popular frameworks to work natively. A user can create an even smaller image tailored to run a specific application by using jlink to shrink the size of the Java runtime.
Windows/Aarch64
Due to demand, Windows/AArch64 has become an important platform with the release of new server-class and consumer AArch64 (ARM64) hardware. While the porting is almost complete, this feature focuses on the port’s integration into the mainline JDK repository.
Foreign Linker API
Foreign linker API provides pure-Java access to native code that is statically typed. In JDK 16, this API will be in an incubator stage.
The foreign linker API, when combined with the proposed foreign-memory access API, will greatly simplify the otherwise error-prone process of binding to a native library.
This plan aims to replace JNI (Java Native Interface) with a superior pure-Java development model, to include C support, and to be flexible enough to support other platforms.
OpenJDK Contributor Improvements
Contributors to OpenJDK will benefit from these enhancements. OpenJDK 16 is available for download.
Migration from Mercurial to Git
The advantages in metadata size, available tools, and hosting are driving this effort.
Migration to GitHub
With JDK 16 source code repositories on the popular code-sharing site, the migration to GitHub is linked to the Mercurial-to-Git migration.
This plan would include JDK feature releases and JDK update releases for Java 11 and later.
The Mercurial JDK and JDK-sandbox were moved to Git, GitHub, and Skara on September 5, 2020, and are now open for contributions.
Improved Networking for Developers
UNIX Domain Socket Channels
Unix-domain socket channels have been added to the socket channel and server socket channel APIs in the nio.channels package, allowing for Unix-domain (AF UNIX) socket support.
The scheme also adds support for Unix-domain socket channels and server socket channels to the inherited channel mechanism.
Interprocess communications on the same host are handled by Unix-domain sockets. In most ways, they’re like TCP/IP sockets, except that instead of IP addresses and port numbers, they’re addressed by filesystem pathnames.
The new capability’s goal is to support all Unix-domain socket channel features that are common on all major Unix platforms as well as Windows.
In terms of read/write behavior, connection setup, server acceptance of incoming connections, and multiplexing with other non-blocking selectable channels in a selector, Unix-domain socket channels will behave similarly to existing TCP/IP channels.
When it comes to local, inter-process communications, Unix-domain sockets are more secure and efficient than TCP/IP loopback connections.
Wrapping Up!
Java is still one of the most popular development platforms, thanks to constant innovation to meet the changing needs of modern application developers.
Oracle added GraalVM Enterprise as an entitlement to the Oracle Java SE Subscription to make it even more valuable to customers. GraalVM can help applications improve performance and consume fewer resources, especially in microservices and cloud-native architectures.
Organizations that use the Oracle Java SE subscription to manage their Java estates not only get the latest enhancements and direct access to Oracle Java experts, but they also save money compared to other options.
You can download JDK 16 on their website.
At Klizo Solutions, our developers are equipped with the latest tools and technologies to help them develop the best projects out there. If you want a well-equipped and technically proficient team that is ready to do the heavy lifting for you, get in touch with us!