5 Running and debugging modular applications

 

This chapter covers

  • Launching a modular application by specifying an initial module
  • Loading resources from modules
  • Validating modules, sets of modules, and module graphs
  • Reducing and listing the universe of observable modules
  • Debugging a modular application with logging

With modules defined, compiled, and packaged into modular JARs as explained in chapters 3 and 4, it’s finally time to power up the JVM and run applications with the java command. This gives us the opportunity to discuss a runtime-related concept: how to load resources from modules (section 5.2). Sooner or later things will go wrong, though, so in section 5.3 we also look into debugging a module configuration with a variety of command-line options.

By the end of the chapter, you’ll be able to launch an application made up of modules. Beyond that, you’ll have a firm understanding of how the module system processes a given configuration and how that can be observed through logging and other diagnostic tools.

This also finishes part 1 of the book, which teaches everything you need to know to write, compile, and run simple modular applications. It lays the groundwork for the more advanced features that parts 2 and 3 are going to look into, chief among them those that support a gradual migration to the module system.

5.1 Launching the JVM with modules

5.1.1 Specifying the main class

5.1.2 If the initial module and main module aren’t the same

5.1.3 Passing parameters to the application

5.2 Loading resources from modules

5.2.1 Resource loading before Java 9

5.2.2 Resource loading on Java 9 and later

5.2.3 Loading package resources across module boundaries

5.3 Debugging modules and modular applications

5.3.1 Analyzing individual modules

5.3.2 Validating sets of modules

5.3.3 Validating a module graph

5.3.4 Listing observable modules and dependencies

5.3.5 Excluding modules during resolution

5.3.6 Observing the module system with log messages

5.4 Java Virtual Machine options

Summary

sitemap