What is new in Java 18 ?
2 minute read


This is an alive post of what will become Java 18, and, as expected, this post will expand and change over time, until the development of Java 18 is frozen in 2022. I am planning to update this post when a new feature (JEP) is targeted for JDK 18, or when there is an important update on an already targeted JEP.

If something is implemented in an incubator module, it is not a permanent feature and it is released to get feedback from developers. API in such a module may change or completely removed (not released in any future JDK release). You need to use --add-modules to use incubator modules.

If something is a preview feature, it is fully specified and implemented, but provided in a release to gather feedback, so it is not a permanent change yet. You need to use --enable-preview to use such features.


  • 2021/11/20: First post.

Java 18 Features

The list is taken from the OpenJDK JDK 18 project page.

JEP 400: UTF-8 by Default

Many methods in standard API depends on a default charset that can be configured in different ways. This JEP aims to make the default charset UTF-8. This will be accomplished by two values of file.encoding system property. If it is set to COMPAT, then the default charset will be found as in JDK 17 and before. If it is set to UTF-8, then the default charset will be UTF-8.

JEP 408: Simple Web Server

A very simple web server will be provided to serve static files.

JEP 413: Code Snippets in Java API Documentation

This JEP will introduce @snippet tag to Java documentations that can be used to write an inline code fragment or link an external source file.

JEP 416: Reimplement Core Reflection with Method Handles

At the moment, different parts of java.lang.reflect uses different mechanisms. These will be reimplemented on top of method handles to simplify maintenance.

JEP 417: Vector API (Third Incubator)

This is the continuation of Vector API introduced in JDK 16 with JEP 338, and as JEP 414 in Java 17. Some improvements and enhancements will be done particularly to support ARM Scalar Vector Extensions and to improve vector operations accepting masks.

JEP 418: Internet-Address Resolution SPI

At the moment, java.net.InetAddress resolves the host names to IP addresses using the system (OS) domain name resolver. This JEP will introduce a way to provide a service loader to InetAddress to locate name resolution provider. If nothing is provided, it will default to existing mechanism of using system resolver.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.