Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Jigsaw Advent Calendar 🎄

This demo project contains the code for a post for the Java Advent Calendar (which I published in on my blog as well). It showcases a couple of features of Project Jigsaw.

The code is released into the public domain via CC0 so it can be used without any limitations.

😴 This demo project is no longer maintained. It is superseeded by a simpler "Hello World" example and the more well-rounded ServiceMonitor application. 😴

The Advent Calendar

Even though I do my best to ignore the whole christmas kerfuffle, it seemed prudent to have the demo uphold "the spirit of the season". So it models an advent calendar:

  • There is a Calendar, which has 24 CalendarSheets.
  • Each sheet knows its day of the month and contains a Surprise.
  • The death march towards Christmas is symbolized by printing the sheets (and thus the surprises) to the console.

Of course the calendar needs to be created first. It can do that by itself but it needs the means to create surprises. To this end it requires a List<SurpriseFactory>.


The demo consists of several sections, each building on the previous ones. There is a branch for each section.

  • 0️⃣ Before Jigsaw: describes the application's organization before Jigsaw
  • 1️⃣ Creating A Module: moves the application into Jigsaw land by moving it into a single module
  • 2️⃣ Splitting Into Modules: explores more of Jigsaw's core features by splitting the application into several modules
  • 3️⃣ Services: introduces services and the ServiceLocator for loose coupling between modules
  • 4️⃣ Automatic Modules: shows how modules can depend on non-modularized JARs
  • 5️⃣ Optional Dependencies: demonstrates dependencies that are mandatory at compile time but are not required at run time


This demo (obviously) requires Java 9. For it to work the Java 9 variants of javac, jar, and java must be available on the command line via javac9, jar9, and java9, e.g. by symlinking them.

The root directory contains a, which - surprise - compiles and runs the example.


An Advent Calendar Demonstrating Jigsaw EA





No releases published


No packages published
You can’t perform that action at this time.