Writing module descriptors
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
write a module-info.java.
Planned topics
- Place
module-info.javaat the source root; the module name is usually reverse-domain style. requiresdeclares a dependency;requires transitivepasses it on to users.exportsmakes a package accessible to other modules; unexported packages stay hidden even if public.exports ... tolimits to named modules.- A JAR with a descriptor on the module path is a module; unnamed or automatic modules cover legacy JARs.
Draft outline details
Demonstration
module com.shop.core {
requires java.sql;
exports com.shop.core.api;
}Check your understanding
Can another module use a public class in a non-exported package?
Show answer
No.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.