concept main class in category java

appears as: main class, main class
The Java Module System

This is an excerpt from Manning's book The Java Module System.

And this is where things go awry—at least, before Java 9. The JVM launches without knowledge of your classes. Every time it encounters a reference to an unknown class, starting with the main class specified on the command line, it goes through all JARs on the class path, looking for a class with that fully qualified name. If it finds one, it loads the class into a huge set of all classes and is finished. As you can see, there’s no run-time concept in the JVM that corresponds to JARs.

As discussed in section 3.4, --module-path mods:libs informs the module system that the mods and libs directories contain ServiceMonitor’s application modules. The option --module monitor defines monitor as the initial module, as a consequence of which the module system will resolve all of monitor’s dependencies and build the module graph as discussed in the previous section. It will then launch the main class you set in the module descriptor during packaging in section 4.5.3: monitor.Main.

> Error: Could not find or load main class
>     some.other.MainClass in module monitor