TechAlpine – The Technology world

Comprehensive Guide on Java 9 and Java 10 Updates

Java 9 and Java 10

Java 9 and Java 10

Let us explore Java 9 first


Java 9 is now available for use. Like with any major software release, it has many new features, enhancements and deprecation. Note that this will be the last major release in the line of the old style of Java release. From 2018, Java releases will be available twice in a year, every 6 months. While there are many new features, the most notable ones have been modularity and the read-eval-print loop (REPL) tool. Availability of modularity allows software developers to divide source code into logical modules, define dependencies across modules and combine required modules at run time to develop software applications. The modularity is, however, not without controversies with Java vendors divided on its effectiveness. The read-eval-print loop (REPL) tool provides feedback to software developers on the code quality or acceptance by just evaluating some declarative statements and expressions. This feature is expected to save time and improve productivity. Among the most important enhancements is the compiler improvements. A new feature, called ahead-of-time (AoT) compilation, can improve compilation speed. Note that the feature is still in the experimental phase. As already mentioned, there are many other features, enhancements and deprecations. To know more about Java 9, read on. To provide ease of understanding, this article is divided into three sections: New features, enhancements and deprecations.

New Features: Here we will discuss about new features.

·         Modularity

It is believed to be the most important feature in this release. Modularity helps you to divide the JDK into logical modules. Later, when you run the program, you can combine the modules to constitute one program. You can clearly define the dependencies and other interactions across modules. Modularity is expected to bring many benefits which include scaling the application up and down based on clients such as mobile devices, better security and performance and maintainability of libraries and large applications for both Java SE (Standard Edition) and Java EE (Enterprise Edition). To implement modularity, many changes have been done which include restructuring of the JDK and Java Runtime Environment (JRE) images and providing access to the JavaFX UI controls and CSS APIs.

If you need to migrate to the modularized Java 9, Oracle allows illegal reflective access from code on the class path by default in JDK 9. However, this facility will be discontinued from the next release.

·         AoT

Though this can improve compiler performance which should be counted as an enhancement, AoT is a new feature. Note that it is still in the experimental phase. We know that the source code need to be compiled before the software program starts to work and Java offers the Just-in-Time (JIT) compilers for that. However, Java programs have become too large even for the JIT compilers to start them fast. As a result, some Java methods are left uncompiled. The AoT can improve startup performance by compiling Java classes into native before launching into the virtual machine.

·         REPL

The REPL helps software developers improve productivity by providing interim feedback on declarative statements and expressions. Developers can feed declarative statements and expressions after writing them partially and get feedback. Rather than having to address many errors after writing long lines of code, the developers can now address issues in the interim.

·         JVM Compiler Interface (JVMCI)

The JVMCI, as the name suggests, is an interface that allows the Java Virtual Machine (JVM) to access and use compilers written in Java dynamically. The JVMCI provides an API which provides ways to the JVM to access the VM structure, install compiled code and plug the compiler to the JVM compilation system. However, you need to note that this feature is still in the experimental phase.

Enhancements : Let us check enhancements

·         Stream API

The Stream APIs allows software developers to add methods so that items from streams can be taken and dropped conditionally; iterate over Stream elements and create a stream from a null value at the time of expanding the Java SE API set which can act as stream sources.

·         Code cache segments

You can divide code cache into segments to improve code performance and allow extensions such as fine-grained locking. Code caching segments can offer better results in the form of improved sweep times due to non-method and non-profiled code skipping and separation and improved execution time for some benchmarks.

·         Improved Unicode and HTML 5 support

The JDK supports the Unicode 8.0 encoding standard which adds 8000 characters, six scripts and 10 blocks. Also, the Javadoc documentation tool can now generate HTML 5 markup.

·         Improved data security

Java 9 adds an API for using the Datagram Transport Layer Security (DTLS). This means improved security to prevent eavesdropping, forgery and tampering of messages used in client -server communications. The enhancement is available for both client and server ends.

·         HTTP upgrade

Java 9 can now support the higher version of HTTP protocol, the HTTP/2 client. Java 9 can upgrade to the protocol with an API. Note that the HTTP/2 protocol is in the beta stage. Java 9 can support the Web socket with the API as well. Now you can stop using the problematic HttpURLConnection API or the HTTP/1 protocol which is too complex to use.

·         Improved JavaScript embedding

JavaScript embedding in Java applications in the form of a runtime and lightweight JavaScript was available from Java 8. The responsibility of embedding was given to Project Nashorn. In Java 9, some improvements have been made to Project Nashorn. JDK 9 comprises a parser API aimed at the ECMAScript syntax tree of Project Nashorn. With the help of the API, Integrated Development Environments (IDE) and server-side frameworks can perform ECMAScript analysis without depending on Project Nashorn’s internal implementation classes.

Deprecation: Exploring deprecated features

Java 9 no longer supports the following features.

·         Applet API

With the browser makers removing support for Java browser plug-ins keeping security considerations in mind and the HTML 5 arriving, the Applet API is deprecated. As alternative, software developers are asked to use the Java Web start which is used to launch applications from a browser. With Applet API, the appletviewer tool is also deprecated.

·         Concurrent Mark Sweep (CMS) Garbage Collector

Though CMS stands deprecated from Java 9, support to versions already using the feature will be discontinued in future releases. CMS is deprecated to speed up the development of other garbage collectors in the HotSpot virtual machine. CMS will be replaced by the low-pause G1 garbage collector on a long-term basis.

·         Java Runtime Environment (JRE) selection feature

The ability to select a JRE at runtime via the Multiple JRE (mJRE) feature is being discontinued because the feature is too complex, lacks comprehensive documentation and is seldom used. The feature made the implementation of the Java Launcher complicated.


From the features and enhancements, the direction at which Java is moving can be inferred. Obviously, the emphasis is on nimbleness and keeping up with the times. The AOT and the JVMCI are designed to make compilation faster and improve performance. Modularity is going to help software companies organize their software projects better. There is an obvious emphasis on web technologies. However, Java 9 release is not without controversies. People are divided on the efficacy of its features. For example, Dmitry Leskov, marketing director at Java technology vendor Excelsior, thinks that the AOT feature is still not mature enough to be tried in the market.

More information on Java 9 can be found here Java9 and Java SE 9 introduction

Coming soon…Java 10

Java 10 is still in the work-in-progress state and therefore, not much is known about it. Neither is the date when it will roll out. Still, some important updates are available which are given below.

Oracle has filed a new JDK Enhancement Proposal (JEP) to collect proposals towards enhancements of Java which will constitute the Java 10. As per the latest reports available, the following changes are expected.

  • Improvement of the Lambda functionality.
  • Better disambiguation.
  • Using underscore for unused parameters.

Although the above changes are related to the Lambda functionality, they are independent functionalities. At this point, the proposed changes are being discussed and the possibility of one or more proposals getting modified or dropped cannot be ruled out.

A brief description of the proposed changes are given below.

Better disambiguation

Lambda functionality was included from Java 8 onwards. However, due to various reasons, the performance was not as expected. Lambdas, it seemed, would confuse software developers who were new to it. Developers would find it frustrating when the compiler failed to recognize Lambdas. This problem is expected to be addressed.

More information on Lambda Leftovers

Using underscore for unused parameters

In the past versions, Lambdas would present itself with many different parameters although the software developer would not need all those parameters at a point in time. So, the developer would need to distinguish unused parameters. Underscores will help distinguishing the unused parameters.

You can find more information here

Note: We will keep this page updated/add new posts on Java 10 and upcoming versions/features. Please keep following.

Tagged on: ,

Leave a Reply

Your email address will not be published. Required fields are marked *

6 + = 14

TechAlpine Books