A small application to demonstrate the Java Platform Module System
Java Shell Batchfile



An example application for my book The Java Module System. The Service Monitor is an application that observes a hypothetical network of microservices by

  • contacting individual services (not really, it just makes up data)
  • collecting and aggregating diagnostic data into statistics
  • persisting statistics
  • making statistics available via REST

It is split into a number of modules that focus on specific concerns. Each module has its own directory that contains the known folder structure, e.g. src/main/java.


The master branch uses basic features, except where it has to use automatic and unnamed modules for the non-modularized dependencies (Spark, Hibernate). Other branches explore individual features of the module system:

The branch features-combined combines many of those into a final version of the application.

Then there are some branches that explore how things can break:


This demo was developed against JDK 9.0.4. The command line scripts for shell and batch use the default commands javac, jar, and java. If these commands don't refer to the Java 9 version on your system, you can enter the appropriate paths at the top of each script.

This is a multi-module Maven project, which your IDE should be able to import. If you're using Maven directly, make sure you have 3.5.0 or higher.

Build and Execution

This being a Maven project means you can build and run with with Maven, but to really see how the module system works, I recommend to use the scripts.


To build and run with Maven execute the following in the project's root:

mvn clean install
mvn exec:exec -pl .

Unfortunately, Jetty doesn't come up due to a NoClassDefFoundError (of org.eclipse.jetty.http.pathmap.PathSpec). Need to inspect that...


The root directory contains a number of Windows batch and Linux shell scripts:

  • compile: compiles the modules one by one
  • multi-compile: compiles all modules at once
  • dry-run: launches the application with --dry-run, which aborts before calling the main method
  • run: launches the application