
- Java Tutorial
- Java - Home
- Java - Overview
- Java - Environment Setup
- Java - Basic Syntax
- Java - Object & Classes
- Java - Constructors
- Java - Basic Datatypes
- Java - Variable Types
- Java - Modifier Types
- Java - Basic Operators
- Java - Loop Control
- Java - Decision Making
- Java - Numbers
- Java - Characters
- Java - Strings
- Java - Arrays
- Java - Date & Time
- Java - Regular Expressions
- Java - Methods
- Java - Files and I/O
- Java - Exceptions
- Java - Inner classes
- Java Object Oriented
- Java - Inheritance
- Java - Overriding
- Java - Polymorphism
- Java - Abstraction
- Java - Encapsulation
- Java - Interfaces
- Java - Packages
- Java Advanced
- Java - Data Structures
- Java - Collections
- Java - Generics
- Java - Serialization
- Java - Networking
- Java - Sending Email
- Java - Multithreading
- Java - Applet Basics
- Java - Documentation
- Java Useful Resources
- Java - Questions and Answers
- Java - Quick Guide
- Java - Useful Resources
- Java - Discussion
- Java - Examples
What are automatic modules in Java 9?
An automatic module is a jar that we put on the modulepath. There is a number of pre-existing libraries that can be used in our applications, and many of these are not yet modularized. To facilitate migration, we can add any library’s jar file to an application’s module path, then use packages in that jar file. It can implicitly become an automatic module and can be specified in the module declaration’s requires directive. The jar’s filename becomes its module name that must be a valid Java identifier that can be used in "requires" directive.
An automatic module:
- Implicitly exports all package types, so any module that can read an automatic module (including unnamed module) has to access public types in automatic module packages.
- Implicitly reads (requires) all other modules, including other automatic modules, and the unnamed module, so an automatic module has access to all public types exposed by the system’s other modules.
%JAVA_HOME%\java --module-path ./libs:./libs-legacy --module app/com.app.Main
Naming of Automatic Module:
- The extension “.jar” is deleted.
- The version number is removed. For instance: mylib-1.2.3 -> mylib
- Non-alphanumeric characters are replaced by periods.
- Repetitive points are replaced by a single point, the points at the start and end of the chain are deleted.
- Related Articles
- What are the advantages of Modules in Java 9?
- What are modules in JavaScript?
- How can we display all modules with classloaders in Java 9?
- What are Perl Modules?
- Automatic resource management in Java\n
- What is maven automatic build tool in Java eclipse projects?
- What are Compact Strings in Java 9?
- What are the enhancements in Internationalization in Java 9?
- What are Python modules for date manipulation?
- What are the most interesting Python modules?
- What are the different module types in Java 9?
- What are the improvements in Process API in Java 9?
- What are the useful commands in JShell in Java 9?
- What are the changes in Memory Management in Java 9?
- What are the CompletableFuture API improvements in Java 9?\n

Advertisements