Java 18 – Simple http Server

What is Java’s simple http server? 

Simple http server released in java 18. Is a command line tool which offers a minimal HTTP server, which serves a single file hierarchy.  It based on the web server implementation in the package. 

General Q & A 

What are the limitations? 

Supports only GET and HEAD methods. 

Supports HTTP 1.1. No HTTP 2. 

Supports only HTTP. No HTTPS. 

What can this http server be used for? 



Educational purposes  


The example starts a simple http web server, which randomly displays a famous quote.

Initialize with parameters.

Set the Port number

Set the file path to where your html directory is located.

(Optional) set the log level

Create Server.

Start the server.


Example can be found here.

Final Thoughts 

This again is following a trend by other languages such as Ruby, Erlang, Python etc, with an out-of-the-box servers from a command line, but I have yet to find a use for it, such as Jshell.    

Leave a Reply

Your email address will not be published. Required fields are marked *