Introduction to Modularity with the Java 9 Platform Module System (JPMS) - Full Day
An overview of Java’s most important new software-engineering technology since its inception 20+ years ago
In this full-day Java 9: Modularity Live Online Training, Paul Deitel introduces the Java Platform Module System (JPMS)—Java 9’s most important new software-engineering technology. Modularity—the result of Project Jigsaw—helps developers at all levels be more productive as they build, maintain and evolve software systems, especially large systems.
Modularity adds a higher level of aggregation above packages. The key new language element is the module—a uniquely named, reusable group of related packages, resources (like images and XML files) and a module descriptor specifying:
- the module’s name
- the module’s dependencies (that is, other modules this module depends on)
- the packages it explicitly makes available to other modules (all other packages in the module are implicitly unavailable to other modules)
- the services it offers
- the services it consumes, and
- to what other modules it allows reflection.
According to JSR 376: Java Platform Module System, the key goals of modularizing the Java SE Platform include: reliable configuration, strong encapsulation, scalable Java Platform, greater platform integrity, and improved performance.
What you'll learn-and how you can apply it
In this live online training, you will:
- Understand the motivation for modularity.
- Review key JPMS requirements.
- Modularize pre-Java-9 code, then execute the modularized version.
- Create module declarations that specify module dependencies with requires, and the packages a module makes available to other modules with exports.
- Selectively allow runtime reflection of types with open and opens.
- Use services to loosely couple system components, making large-scale systems easier to develop and maintain.
- Indicate that a module explicitly uses a service or provides a service implementation with the uses and provides...with directives, respectively.
- Use the jdeps command to determine a module’s dependencies.
- Understand how unnamed and automatic modules enable you to continue using non-modularized pre-Java-9 code in Java 9.
- Use the NetBeans IDE to create module graphs that visualize the modular JDK as well as your own modular systems.
- See the module resolver in action as it determines runtime dependencies.
- Use jlink to create smaller runtimes appropriate for resource-constrained devices—for example Internet of Things (IoT) devices.
- And more.
This training course is for you because...
- You’re a Java developer interested in the upcoming Java 9.
- You need to migrate legacy code into modularized Java 9.
- You want to familiarize yourself with the Java Platform Module System’s capabilities and migration mechanisms.
- Practicing Java developers
- Programmers familiar with the Java concepts presented in Chapters 1-11 of Java® 9 for Programmers, or Lessons 1-11 of Java 8 Fundamentals LiveLessons (each of which is available on SafariBooksOnline.com)
SETUP REQUIRED PRIOR TO THE FIRST COURSE MEETING:
Before taking this course, if you want to do the demonstrations and participate in labs, you must install the latest JDK 9 Developer Preview, the course’s source-code examples and the NetBeans IDE with early access JDK 9 support. We use the NetBeans IDE’s modularity support and tools to create module graphs and to show a project’s modular structure. IDEs like IntelliJ and Eclipse also have some early access JDK 9 support and will likely provide more in the future.
- Download the latest JDK 9 for Windows, macOS or Linux: http://jdk.java.net/9/
- Download the source-code for this course: Will be provided to students
- Download the early access NetBeans IDE with Java 9 support (for Windows, macOS or Linux): http://wiki.netbeans.org/JDK9Support#Getting_Started (be sure to follow the instructions on this page) enter link description here
Setup/Install Video Tutorials
Installing JDK 9 Developer Preview on Windows
- YouTube https://youtu.be/9C9e8EOxok8
- MP4: http://deitel.com/bookresources/Java9FP/InstallingJava9OnWindows.mp4
- MOV: http://deitel.com/bookresources/Java9FP/InstallingJava9OnWindows.mov
Installing JDK 9 Developer Preview on macOS
- YouTube: https://youtu.be/6hOd5Dyr6Sw
- MP4: http://deitel.com/bookresources/Java9FP/InstallingJava9OnMacOS.mp4
- MOV: http://deitel.com/bookresources/Java9FP/InstallingJava9OnMacOS.mov
We also provide Getting Started videos discussing these downloads and the installation steps at http://www.deitel.com/books/Java9FP. These videos contain Paul Deitel’s contact information, please feel free to contact Paul before the course if you have any questions about the course content and/or setup.
SETUP REQUIRED PRIOR TO THE FIRST COURSE MEETING: - Before taking this course, if you want to do the demonstrations and participate in labs, you must install the latest JDK, the course’s source-code examples, the NetBeans 9 IDE beta and/or the IntelliJ IDEA Ultimate (licensed or trial version). We use the IDEs modularity support to create module graphs and to show a project’s modular structure. - Download the latest JDK for Windows, macOS or Linux: http://www.oracle.com/technetwork/java/javase/downloads/index.html - Download the beta of NetBeans 9 IDE (cross-platform ZIP): http://netbeans.apache.org/download/nb90/nb90-beta.html - Download IntelliJ IDEA Ultimate: For this, Paul recommends first installing the JetBrains Toolbox app from https://www.jetbrains.com/toolbox/app/. Once installed, open the toolbox, then select IntelliJ IDEA Ultimate. The toolbox can help you install/uninstall apps and notify you of updates as well. If you prefer, you can install just the IDE from https://www.jetbrains.com/idea/download/ - Source code will be provided closer to the event date.
About your instructor
Paul J. Deitel, CEO and Chief Technical Officer of Deitel & Associates, Inc., is an MIT graduate with 38 years in computing. Paul is one of the world’s most experienced programming-languages trainers, having taught professional courses to software developers since 1992. He has delivered hundreds of programming courses to industry clients internationally, including Cisco, IBM, Siemens, Sun Microsystems (now Oracle), Dell, Fidelity, NASA at the Kennedy Space Center, the National Severe Storm Laboratory, White Sands Missile Range, Rogue Wave Software, Boeing, Puma, iRobot and many more. He and his co-author, Dr. Harvey M. Deitel, are among the world’s best-selling programming-language textbook/professional book/video authors
The timeframes are only estimates and may vary according to how the class is progressing
Segment 1 Introduction
Segment 2 Module Declarations
- 2.1 requires
- 2.2 requires transitive—Implied Readability
- 2.3 exports and exports…to
- 2.4 uses
- 2.5 provides…with
- 2.6 open, opens and opens…to
- 2.7 Restricted Keywords
Segment 3 Modularized Welcome App
- 3.1 Welcome App’s Structure
- 3.2 Class Welcome
- 3.3 module-info.java
- 3.4 Module-Dependency Graph
- 3.5 Compiling a Module
- 3.6 Running an App from a Module’s Exploded Folders
- 3.7 Packaging a Module into a Modular JAR File
- 3.8 Running the Welcome App from a Modular JAR File
- 3.9 Aside: Classpath vs. Module Path
Segment 4 Creating and Using a Custom Module
- 4.1 Exporting a Package for Use in Other Modules
- 4.2 Using a Class from a Package in Another Module
- 4.3 Compiling and Running the Example
- 4.4 Packaging the App into Modular JAR Files
- 4.5 Strong Encapsulation and Accessibility
Segment 5 Module-Dependency Graphs: A Deeper Look
- 5.1 java.sql
- 5.2 java.se
- 5.3 Browsing the JDK Module Graph
- 5.4 Error: Module Graph with a Cycle
LUNCH BREAK (1 hour)
Segment 6 Migrating Code to Java 9
- 6.1 Unnamed Module
- 6.2 Automatic Modules
- 6.3 jdeps: Java Dependency Analysis
Segment 7 Resources in Modules; Using an Automatic Module
- 7.1 Automatic Modules
- 7.2 Requiring Multiple Modules
- 7.3 Opening a Module for Reflection
- 7.4 Module-Dependency Graph
- 7.5 Compiling the Module
- 7.6 Running a Modularized App
Segment 8 Creating Custom Runtimes with jlink
- 8.1 Listing the JRE’s Modules
- 8.2 Custom Runtime Containing Only java.base
- 8.3 Creating a Custom Runtime for the Welcome App
- 8.4 Executing the Welcome App Using a Custom Runtime
- 8.5 Using the Module Resolver on a Custom Runtime
Segment 9 Services and ServiceLoader
- 9.1 Service-Provider Interface
- 9.2 Loading and Consuming Service Providers
- 9.3 uses Module Directive and Service Consumers
- 9.4 Running the App with No Service Providers
- 9.5 Implementing a Service Provider
- 9.6 provides…with Module Directive and Declaring a Service Provider
- 9.7 Running the App with One Service Provider
- 9.8 Implementing a Second Service Provider
- 9.9 Running the App with Two Service Providers