Java 17 vs Java 21

Fth Feyza
4 min readOct 24, 2023

Java 17 and Java 21 are LTS (Long Term Support) versions of java.
In this article, we take a look at what new features each version brought. We mainly focus important for developers.
P.S. You can see all features from my other posts.

There are many performance and security improvements but I pick 9 features that developers can use.

Java 18:

1. JEP 408: Simple Web Server

With the simple web server proposal, a command-line tool would be provided to start a minimal web server that serves static files only. No CGI or servlet-like functionality is available.
This JEP for simple test, educational vs..

It can be run like this:

$ jwebserver
If startup is successful then jwebserver prints a message to System.out listing the local address and the absolute path of the directory being served. For example:

$ jwebserver
Binding to loopback by default. For all interfaces use “-b 0.0.0.0” or “-b ::”.
Serving /cwd and subdirectories on 127.0.0.1 port 8000
URL: http://127.0.0.1:8000/
By default, the server runs in the foreground and binds to the loopback address and port 8000. This can be changed with the -b and -p options. For example, to run the server on port 9000, use:

--

--