O'Reilly logo

Java 9 Cookbook by Nick Samoylov, Mohamed Sanaulla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Modularizing math.util.jar

  1. Copy MathUtil.java from chp3/6_bottom_up_migration_before/math_util/src/com/packt/math to the location chp3/6_bottom_up_migration_after/src/math.util/com/packt/math.
  2. Create the module definition file module-info.java under chp3/6_bottom_up_migration_after/src/math.util with the following definition:
        module math.util{          exports com.packt.math;        }
  1. From within the folder 6_bottom_up_migration_after, compile the Java code of the modules by running the command:
      javac -d mods --module-source-path src $(find src -name *.java)
  1. You will see that the Java code in the module math.util and banking.util is compiled into the mods directory. 
  2. Let's create a modular JAR for this module: 
 jar --create --file=mlib/math.util.jar ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required