Questions tagged [java-module]

Refers to the module as defined by the Java Platform Module System in Java 9+.

A module in the Java Platform Module System is a named, self-describing collection of code and data. Its code is organized as a set of packages containing types, i.e., Java classes and interfaces; its data includes resources and other kinds of static information. The only module known specifically to the module system, in any case, is the base module, which is named java.base.

A module is described using a , which itself is a new construct added in to provide a module definition.

Module names, like package names, must not conflict. The recommended way to name a module is to use the reverse-domain-name pattern that has long been recommended for naming packages. The name of a module will, therefore, often be a prefix of the names of its exported packages, but this relationship is not mandatory.

Module declarations are part of the Java programming language, rather than a language or notation of their own, for several reasons. One of the most important is that module information must be available at both compile time and run time in order to achieve fidelity across phases, i.e., to ensure that the module system works in the same way at both compile time and run time. This, in turn, allows many kinds of errors to be prevented or, at least, reported earlier—at compile time—when they are easier to diagnose and repair.

The Java SE 9 Platform Specification uses the module system to divide the platform into a set of modules. An implementation of the Java SE 9 Platform might contain all of the platform modules or, possibly, just some of them.


A java.lang.Module represents a run-time module, either named or unnamed.

Named modules have a name and are constructed by the Java Virtual Machine when a graph of modules is defined to the Java virtual machine to create a module layer.

An unnamed module does not have a name. There is an unnamed module for each ClassLoader, obtained by invoking its getUnnamedModule method. All types that are not in a named module are members of their defining class loader's unnamed module.

The package names that are parameters or returned by methods defined in this class are the fully-qualified names of the packages as defined in section 6.5.3 of The Java™ Language Specification, for example, java.lang.

727 questions
0
votes
0 answers

Package conflict when compiling a Java 9 module

I am trying to compile a simple module with a single direct dependency and I am getting many errors about packages that are read from 2 libraries. I am using the latest stable version of the libraries and I see that the package is split between…
0
votes
1 answer

How to get a Module by its name in Java 9?

How to get java.lang.Module by string name in Java 9? For example, we have String name = "some.module"; Module module = //how to get here it?
Pavel_K
  • 10,748
  • 13
  • 73
  • 186
-1
votes
1 answer

Can´t run JavaFX application outside ide

I want run JavaFX application with module but dont know how to do. I tried several times but i never got it. I use Eclipse, and export the proyect with the first selected option. Image module MiProgramaInterfaz { requires javafx.controls; requires…
ReTuR
  • 1
-1
votes
1 answer

Replace java platform system logger with slf4j in spring boot application

I've got a spring boot application build as multi-modular gradle project (old-style, not fancy jigsaw) What I want to achieve - is replace java platform loggers (e.g., SSlLogger/ System.getLogger) with sl4j & logback that are used in my app and are…
-1
votes
1 answer

Jigsaw / Jlink for modular Java projects to minimize JRE size

I am trying to understand the differences or the associations between these two principles / feature for Java modular projects. I am trying to minimize the JRE size by reduce the use of the external libraries / modules. In order to do that, I made…
-1
votes
1 answer

Properties files into a common Java Module without Spring annotations

I'm creating a JavaModule with some utilities class. This module will used from some different Java Applications (these projects will be have the dependency into their pom files). Into my JavaModule I would like to use some properties files to…
Safari
  • 11,437
  • 24
  • 91
  • 191
-1
votes
1 answer

Java 9 Modularity with a packages

Let's say I have 2 modules: module1 has the package package1 module2 has package2, package3 and package4 I want package1 to be visible to only package2 in module2. not to any other packages (package3 or package4) in module2. Is this possible using…
James
  • 441
  • 2
  • 6
  • 9
1 2 3
48
49