更新时间:2021-07-02 18:38:52
cover
Title Page
Copyright
Modular Programming in Java 9
Credits
About the Author
About the Reviewers
www.PacktPub.com
Why subscribe?
Customer Feedback
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
Introducing Java 9 Modularity
Modularity in Java
Rethinking Java development with packages
The unfortunate tale of a library developer
The impossible task of a deployment engineer
The classpath problem
Java - the 20-year-old code base
Legacy classes
Internal APIs
Java Platform Module System
Project Jigsaw
Summary
Creating Your First Java Module
Setting up the JDK
Switching between JDKs
Setting up the NetBeans IDE
Java 9 modules
Traditional Java code structure
What is a module?
Creating a module
Creating your first Java module
Compiling your module
Executing your module
Creating a module using NetBeans
The address book viewer application
Handling possible errors
Handling Inter-Module Dependencies
Creating the second module
Compiling two modules
Configuring module dependency
Module versioning
Rethinking package structure
Understanding module path arguments
Revisiting classpath
Revisiting the classpath problems
Introducing the Modular JDK
Examining the legacy JDK
The JRE structure
Understanding rt.jar
The problem with this model
The attempted solution - Compact profiles
The state of API encapsulation
Understanding internal APIs
The attempted solution - Deprecation warnings and documentation
Enter Project Jigsaw
Platform modularity
The impact of platform modularity
Module graph
The java.base module
Browsing modules
Module types
Examining platform file structure
Observable modules
Revisiting the two problems
Solving the monolithic runtime
Solving the API encapsulation problem
Using Platform APIs
Adding logging ability
Using an alternative compiler command
Reading contacts from an XML file
Removing the hard-coded contact list
Creating the module
Coding the XmlUtil class
Coding the ContactLoader class
Shared classes
Dependency leakage
Consuming the new module
Adding UI with Java FX
Module Resolution Readability and Accessibility
Readability
Accessibility
Interface and implementation accessibility
Split packages