Liferay Development

Liferay Consulting

Liferay Training

Your Trusted Liferay Solutions Partner

Wednesday, September 27, 2017

Java 9 Features

Java 9 is now available and it has many promising features.

Java platform module system
Jshell Command Line Tool
New Java Version String format
Compile for Older Platform Versions
Private methods in Interface
Http API Support
Core Libraries Improvements in JDK 9 


Java platform module system

Java 9 enabled with new way of development based on modules. A module is self-described collection of code and data with unique identification name. It is kind of Dynamic Component development similar to OSGi.

Usually we need other modular framework to enable dynamic component development in java and now Java platform itself support Dynamic Component Development.

To support module development capability they have introduced different tools such as javac, jlink, jmod and java, which helps to develop and run the modules.

Java 9 is introduced new phase link time for modules, which comes between compile and run time. In this phase module assembled and optimized.

Find more details about Jlink Tool from below link


 Java 9 come up with new packaging system JMOD for modules, which is similar to JAR in addition to JAR feature JMOD (Java Module) contained native code and configuration files as well.

Find more details about JMOD from the below link


Java Platform Module System compliances specified in JSR 376
JDK also divided into set of modules, if the application required specific modules we can defined in the application rather than load all modules in the Java Run Time Image. This feature will make application lightweight and its improved performance of application.
Java 9 Removes rt.jar and tools.jar from the Java runtime image

Jshell Command Line Tool (REPL)

Java 9 provided Jshell Command Line Tool to execute and run the java code in the shell.
Usually this kind of interface available for Python and Scala languages. Now it is available in Java 9. JShell is Read–Eval–Print-Loop – REPL for short. We can write java statements in the shell and evaluate then execute.

Find more details from below link


New Java Version String format

New Java Version Sting format makes easy understand when any release is out. It have specific pattern it will explain what kind of release like Major /Minor/Patch/ Security.
The following is release version format


$MAJOR.$MINOR.$SECURITY.$PATCH


Provided more custom selection for installers

For windows have optional selection for web deployment. We can enable or disable web deployment through installers.

Added more Diagnostic Commands

Java 9 have defined additional Diagnostic Commands to improve the ability to diagnose issues with hostspot and JDK. Jcmd is tool, which have set commands to diagnose issues
Find more details about Jcmd from the below link.


Compile for Older Platform Versions

Java 9 improved the javac tool to compile java code in older version java, such way it can run in older version JVM.

Find the more details about javac from the below link


JVM Command-Line Flag Arguments Validation

Java 9 provides the way to validate JVM command line arguments such a way it will avoid the failures and display error message after execute the commands.

Unified JVM Logging

Unified JVM Logging helps common logging system for all java modules.
-Xloggc java option will enable Unified JVM Logging

Find more about –Xloggc from following link


New HTTP Client

Java 9 now have Http support and its replacement for old HttpURLConnection. It support HTTP/2 protocol and Web Socket handshake. Before we use Apache Http client libraries to work with Http URL handshake. Now this support added in Java 9, now we do not required additional external libraries when work with http handshaking.

Private methods in Interface

Java 9 introduced the Private methods in the interface and it will help us to split lengthy default methods in interfaces.

Core Libraries Improvements in JDK 9 

The following are some of features, which improved in the Java core Libraries.

Process API Updates
Variable Handles
Compact String
Platform Logging API and Service
Convenience Factory Methods for Collections
XML Catalogs
Filter Incoming Serialization Data

The following is place you can find all Java 9 features in detail.


Author

Popular Posts

Recent Posts

Recent Posts Widget