Built-in HTTP server
Java 18 includes a built-in minimal HTTP server for prototyping and file serving.
// Install and configure a web server
// (Apache, Nginx, or embedded Jetty)
// Or write boilerplate with com.sun.net.httpserver
HttpServer server = HttpServer.create(
new InetSocketAddress(8080), 0);
server.createContext("/", exchange -> { ... });
server.start();
// Terminal: serve current directory
$ jwebserver
// Or use the API (JDK 18+)
var server = SimpleFileServer.createFileServer(
new InetSocketAddress(8080),
Path.of("."),
OutputLevel.VERBOSE);
server.start();
Zero setup
Run jwebserver in any directory — no installation, config, or dependencies needed.
Built into the JDK
Ships with every JDK 18+ installation, always available on any machine with Java.
Great for prototyping
Serve static files instantly for testing HTML, APIs, or front-end development.
Available since JDK 18 (March 2022)
JDK 18 added a simple, zero-dependency HTTP file server accessible via the jwebserver command-line tool or the SimpleFileServer API. It serves static files from a given directory with no configuration needed. The CLI tool is ideal for quick prototyping, testing, and ad-hoc file sharing — no external dependencies or frameworks required. The API allows programmatic use with customizable handlers and output levels.