Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
How can we modify an existing module in Java 9?
The module is a named, self-describing collection of code and data. The code has been organized as a set of packages containing types like Java classes and interfaces. The data includes resources and other kinds of static information. We need to declare a module then add module-info.java at the root of the source code.
Below is the template of the "module-info.java" file.
module{ requires ; requires ; exports ; exports ; exports to }
We can use certain command-line options that help us to modify existing modules and add dependencies to them, export additional packages.
Below are the few command-line commands that can be used to modify an existing module.
1) --add-reads= (, )*
The above command can update
2) --add-exports/ = (, )*
The above command can update
3) --add-opens/ = (, )*
The above command update
4) --patch-module= (; )*
The above command can replace or increase a module with classes and resources in jar files or directories.
