

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 Questions & Answers
- What are the advantages of Modules in Java 9?
- What are Perl Modules?
- What are modules in JavaScript?
- What are Compact Strings in Java 9?
- How can we display all modules with classloaders in Java 9?
- Automatic resource management in Java
- What are the enhancements in Internationalization in Java 9?
- What are the CompletableFuture API improvements in Java 9?
- 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 is maven automatic build tool in Java eclipse projects?
- What are Python modules for date manipulation?
- What are the benefits of immutable collections in Java 9?
Advertisements