JAVA 9 Features
Java 9 has been finally released. The programming enthusiasts would be pretty relieved as Java 9 Standard Edition was previously delayed due to modularity controversy. If you are seeking for Java SE Development Kit 9 you may visit the link below:
https://www.oracle.com/java/technologies/javase-downloads.html
Java 9 features: Brief overview
Project Jigsaw – Module System
So, how is this different from the last version of Java SE 8? The most effective change in Java SE 9 is the change in the form of Project Jigsaw, which is the new module system. It’s the most important feature of java, which has been criticized a lot. This feature brings modularity to JDK, runtime images, Java source code etc. In the world of Java OSGi, JARs are considered as the unit of modularity. By the way, developers can make their own modules and simplify the code
The primary goals of this project were to:
- Make it easier for developers to construct and maintain libraries and large applications;
- Improve the security and maintainability of Java SE Platform
Implementations in general, and the JDK in particular; - Enable improved application performance, and lastly
- Enable the Java SE Platform, and the JDK, to scales down for use in a small computing cloud and dense cloud employments
JShell
With JDK 9, now one can fire JShell from the console and go crazy with their Java code. JShell allows you to test different Java constructs without any hassle. Jshell introduces a REPL(Read-Eval-Print-Loop) environment in java when Java 9 is released. With this new style of writing Java code, you can write and test small snippets of code quickly and easily. JShell will compile and run the code there and then.
Stream API enhancements
With Stream API enhancements, Java 9 comes with added methods to conditionally take or drop items from the Stream, create a Stream from nullable value while expanding Java SE APIs, etc.
Process API Changes
With Process API improvements, Java 9 ensures that the OS process is controlled and managed in a better manner. For instance, The Runtime.getRuntime().exec() API was the only way to spawn a new process before Java 5. After which ProcessBuilder API was introduced which was better for spawning a new process.
In Java SE 9 we can now obtain a lot of information about the process via the API java.lang.ProcessHandle.Info API:
- The commands used to start the process
- The arguments of the command
- Time instant when the process was started
- Total time spent on it and the user who created it
Segmented Code Cache
With the help of Segmented Code Cache in JDK 9, the code cache can be divided into different segments. Each of those segments contains compiled code of a particular type. This Java 9 feature is expected to improve performance.
Instead of a single area, the code cache will be segmented into 3 by the code’s lifetime in cache:
- Code that will stay in cache forever
- Short lifetime
- Potentially long lifetime
Due to these segmentations, several performance improvements occur. E.g. the method sweeper would be able to skip non-method code and act faster.
Ahead of Time Compilation
While it’s in the experimental stage, AOT- compilation is expected to improve the start-up time of applications.
New HTTP 2 Client
Java 9 features list is incomplete without the mention of new HTTP/2 and WebSocket. It’ll improve web page loading times, performance, and reduce resource usage.
Parser API for Nashorn
JDK 9 ships with parser API for Nashorn, whose goal was to implement a lightweight high-performance JS runtime in Java with native JVM. This API ensures better Project Nashorn JS support.
Other major-minor features
The other Java 9 features are:
- Multi-release JARs
- Process API updates
- Garbage Collector improvements
- Better Javadoc
- Private interface methods
That’s not all; you can find more by the following link:
https://www.oracle.com/java/technologies/javase/9u-relnotes.html