Home >Java >javaTutorial >What is the module system in Java 9?

What is the module system in Java 9?

PHPz
PHPzforward
2023-08-19 20:29:07585browse

Java 9中的模块系统是什么?

One of the big changes in Java 9 features is ModulesSystem. Java 9 introduced the following features as part of the Jigsaw project.

  • Modular JDK
  • Modular Java source code
  • Modular runtime image
  • Encapsulation of Java internal API
  • Java Platform Module System

One of the main motivations for using modulesSystem is to provide modularity for running on devices with less available memory JVM. The JVM runs only the modules and APIs required by the application.

Syntax

<strong>module Module-Name {
   requires moduleName;
   exports packageName;
}</strong>

Modular JAR files contain an additional module descriptor. In this module descriptor, the dependencies of other modules are expressed through the "requires" statement. The "exports" statement controls which packages can access other modules.

The above is the detailed content of What is the module system in Java 9?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete