O'Reilly logo

Java 9 Programming By Example by Peter Verhas

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

What is a Java module

A Java module is a collection of classes in a JAR or in a directory that also contain a special class named module-info. If there is this file in a JAR or directory then it is a module, otherwise it is just a collection of classes that are on the classpath (or not). Java 8, and the earlier versions, will just ignore that class as it is never used as code. This way, using older Java, causes no harm and backward compatibility is maintained.

The module information defines what the module exports and what it requires. It has a special format. For example, we can place module-info.java in our SortInterface Maven module.

module packt.java9.by.example.ch03{         exports packt.java9.by.example.ch03;         }

This means that any class, ...

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