Home » Core Java » Java 9 New Features Tutorial

About Sripriya Venkatesan

Sripriya is a Computer Science engineering graduate, she topped her graduation class and was a gold medalist. She has about 15 yrs of work experience, currently working as a technical architect/ technical manager for large scale enterprise applications, mainly around Java and database technologies; spanning different clients, geographies and domains. She has traveled to multiple countries and strives for work life balance. She is passionate about programming, design, architecture and enjoys working on new technologies.

Java 9 New Features Tutorial

1. Introduction

In this example, I would like to show you how to get started with Java 9 and write a simple Hello World program. Here, I present a simple example to get started along with details of some of the important new features.

Java 9 is a major release. At the time of writing of this article, JDK 9 is currently available for early access download on the oracle site and is expected to be released on July 27, 2017. This document attempts to summarize details on how to get started with JDK 9 and some of the main features with this new release.

Complete list of features can be viewed at the oracle site.

2. Getting started

To download the currently available early access JDK or JRE 9, visit http://jdk.java.net/9/

Downloading JDK and accepting license agreement

Downloading JDK and accepting license agreement

As shown in the image above, at the site, accept the license agreement and proceed to the download section as shown below.

Download JDK

Download JDK

Please select the appropriate OS and option for 32/ 64 bits for the OS to download the JDK/ JRE. It is also recommended to download the documentation along with the JDK/ JRE installation.

3. Running a Hello World program on Java 9

The directory structure has changed in JDK 9. The below section lists the steps to get a simple Hello World program to run on JDK 9 via command line.

JDK Install Directory

JDK Install Directory

JDK 9 installation on my windows machine looks like the image above.

A sample Hello World program is listed below, do keep in mind that this is a legacy class and does not use the new module feature introduced in java 9.


public class HelloWorldJDK9 {
	public static void main(String[] args) {
		System.out.println("Hello world");

To compile this class on the JDK 9 installed, run the below javac command. To run the generated class, use the regular java command or run the class using eclipse.



You may use eclipse or an IDE of your choice (may need installation of Java 9 support plugins).

4. Changes in Java 9 and new features

4.1 Version in class files

Verify the class file created in step 3 by running javap as shown below. The output of javap has major version listed (as highlighted in yellow). The version number for Java 9 compiled classes is 53 as against version 52 for Java 8 compiled classes.

javap command

javap command

4.2 Module system/ Jigsaw

Module system is one of the most important changes in Java 9. This provides an entirely new dimension to writing and deploying java code. JDK 9 has reorganized JDK and JRE into set of modules as well. With the new module system, application would consist of a number of modules.

Also, with the modularisation of JDK, source code has been restructured to make it easy to maintain. Class and resource files previously stored in lib/rt.jar and lib/tools.jar and other internal jars would be stored in different formats in the lib directory.

More details can be found at the open jdk sites for JEP 261, 200 and 220.

4.3 Deprecation of Applet API

With newer web browser technologies available, Oracle plans to deprecate the Applet API and it is recommended to rewrite applets as support may be removed in future release.

Alternatives for applets and embedded JavaFX applications include Java Web Start and self-contained applications. Details are available at this link.

4.4 HTML 5 javadocs

Java 9 will have support for creating javadocs in HTML 5 along with the existing HTML 4 support. Refer details at the jira for this change.

4.5 G1 as default Garbage Collector

Java 9 has made G1 the new default garbage collector. G1 is expected to provide overall performance improvement. Also, some GC combinations that were deprecated in Java 8 have been removed.

Refer JEP 214 for more details.

Here is a detailed summary of the flags and flag combinations that will stop working:

DefNew + CMS       : -XX:-UseParNewGC -XX:+UseConcMarkSweepGC
ParNew + SerialOld : -XX:+UseParNewGC
ParNew + iCMS      : -Xincgc
ParNew + iCMS      : -XX:+CMSIncrementalMode -XX:+UseConcMarkSweepGC
DefNew + iCMS      : -XX:+CMSIncrementalMode -XX:+UseConcMarkSweepGC -XX:-UseParNewGC
CMS foreground     : -XX:+UseCMSCompactAtFullCollection
CMS foreground     : -XX:+CMSFullGCsBeforeCompaction
CMS foreground     : -XX:+UseCMSCollectionPassing

5. Summary

This article is aimed at providing a starter to Java 9 and some important new features. JDK 9 has some exciting new features and promises to change how we currently write and deploy java code.

6. References

Oracle site has excellent details of the new JDK 9 features.

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!


1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design


and many more ....


Receive Java & Developer job alerts in your Area


Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Newest Most Voted
Inline Feedbacks
View all comments
3 years ago

Java 9 is a major update to Java, which brings the language up to the state of development. It allows Java to make better use of more modern hardware and fixes lots of gaps in Java.

3 years ago

Great blog! Amazing features of Java 9 With work ongoing to move ahead on the next version of conventional Coffee, designers can start getting excited about what they will get with the organized update. Thanks for sharing with us, will look forward more from you!