Now the module path (the src
directory) has two modules. We can now run the javac
command to compile all classes in both modules, since we are supplying src
as the module source path.
Here, packt.sortutil
is the simpler of the two modules. Since it doesn't have any external dependencies, this should just work like the packt.addressbook
module did in the previous chapter. Let's look at the packt.addressbook
module. Things are more interesting here. Since we've moved the sort related classes to the packt.sortutil
module, the packt.addressbook
module doesn't have the classes in the packt.util
package anymore. But there is code in the module that still uses it. Notice what happens when we try to compile both the modules with the same command as the previous chapter. This time, since we are compiling two modules, we specify both the module names to the --module
argument separated by a comma.
$ javac -d out --module-source-path src --module packt.addressbook,packt.sortutil...