Questions tagged [module-info]

Used for module-info.class related queries used for module declaration in Java since its Java 9 release. This would mostly be coupled with java-9 or above tag.

The State of the Module System defines module declarations as:

A module’s self-description is expressed in its module declaration, a new construct of the Java programming language.

The simplest possible module declaration merely specifies the name of its module:

module com.foo.bar { }

The source code for a module declaration is, by convention, placed in a file named module-info.java at the root of the module’s source-file hierarchy. The source files for the com.foo.bar module, e.g., might include:

module-info.java
com/foo/bar/alpha/AlphaFactory.java
com/foo/bar/alpha/Alpha.java
...

A module’s declaration does not include a version string, nor constraints upon the version strings of the modules upon which it depends. This is intentional: It is not a goal of the module system to solve the version-selection problem, which is best left to build tools and container applications.

Module declarations are part of the Java programming language, rather than a language or notation of their own, for several reasons

157 questions
3
votes
1 answer

module-info.java compile fail with maven-compiler-plugin and automatic modules

I'm using v3.7.0 of the plugin as required and JDK 9.0.1. I have added two requires statements, each referring to a jar in the class path (automatic module). The module-info.java compiles successfully in Eclipse after I moved the jars to Modulepath.…
GabeV
  • 859
  • 8
  • 21
3
votes
1 answer

Can automatic module read classes of named module in exported package in Java 9?

I am trying to see how Weld CDI container can work with JPMS. So I have the following configuration. I have my named module and weld-se-shaded as automatic module. In my module I have module my.module { requires weld.se.shaded; exports…
Pavel_K
  • 10,748
  • 13
  • 73
  • 186
2
votes
1 answer

How to access files in /META-INF/resources when module-info.java is present?

When TestNG invokes Class.getResourceAsStream() on an external module, it is returning null. Per Resources visibility with java9 modules when a user wants to access /resources/someResource.xml in a library that contains module-info.java, the module…
Gili
  • 86,244
  • 97
  • 390
  • 689
2
votes
0 answers

How to configure java 9 module with many shared java 8 dependencies?

I have a project where dependencies were designed based on java 8, I'm using java 9 modules. I keep getting errors related to multiple exports. java: java.lang.reflect.InvocationTargetException Modules nd4j.common and nd4j.api export package…
Borel
  • 29
  • 4
2
votes
1 answer

javafx.controls cannot be resolved to a module in module-info.java

Actual state I am learning JavaFx and trying to make a reusable component. The project is being developed in VSCode. The project is very simple and deals with a launcher and the reusable component. I was refactoring and when adding the modules…
vktop
  • 51
  • 6
2
votes
1 answer

Module-Info For Netty

I'm trying to build a project that depends on io.netty, and it's the one third-party library that doesn't seem to support Java9+ modules since I don't see any module-info.class inside the jars. When I come to run my project I get the error: Error…
Graham Seed
  • 742
  • 3
  • 10
  • 24
2
votes
1 answer

ServiceLoader not finding any services

I'm facing an issue where ServiceLoader does not find one provided service. I have tested with regular project and the following sources: // test/Tester.java package test; public interface Tester { } // test/TesterImpl.java package test; public…
2
votes
0 answers

Using Java14 to manually compile the module, but an error is reported

I wrote a very simple Example of a Java module following the tutorial, but when using the javac command, I didn't get an error, and when compiling with the Java command, I got an error: Error occurred during initialization of boot…
tea
  • 31
  • 1
2
votes
1 answer

No SSE encoder configured and the data is not String?

org.springframework.core.codec.CodecException: No SSE encoder configured and the data is not String On Spring Initialize, I generated a project with just Spring Reactive Web. And here is the main class as I made it a REST controller. package…
2
votes
0 answers

Difficulty integrating a look and feel to my project

This is how I proceeded. 1. Ensure that your classpath contains all required Synthetica libraries, means the core library (synthetica.jar) and the used theme library. Note: In Synthetica V3 the core library contains Synthetica core files only, no…
2
votes
0 answers

Module-info.java when there are duplicate dependencies

I have a JavaFX project and I'm using Maven. With the intent of making the software runnable both for Linux and Windows, I have to import each dependecy of JavaFX twice, one for Linux and another for Windows, making the pom.xml file looks like…
DarkStrix
  • 21
  • 1
  • 3
2
votes
0 answers

Does Proguard support obfuscate package names in module-info.class

I need to obfuscate a module including the exports packages declared in module-info.class.(because it will be a dependence of another module, both of them need to be obfuscated). The proguard seems not support to handle the module-info.class. I've…
2
votes
1 answer

Java modules and the JAR MANIFEST Class-Path attribute

I have a Java 8 application I am working on converting to Java 11 and of course with this I am working with the module system for the first time. I have my application Maven assembly configuration set such that all the JAR files are put in a /lib…
Michael Remijan
  • 687
  • 7
  • 22
2
votes
0 answers

Updating a broken dependency module-info.java without recompiling it?

My code depends on Logback which seems to have a bug in its module-info.java file. The author seems to be indisposed for an extended period of time. Is there a way for me to patch this dependency's module-info.java file without having to recompile…
Gili
  • 86,244
  • 97
  • 390
  • 689
2
votes
1 answer

Java 11. javac/ warning: [options] module name in --add-reads option not found: moduleB

I have a small java 11 module project, which consists of two modules moduleA and modules. moduleB MyService.java package com.company.packageB; public class MyService { public String getHelloWorld(){ return "Hello world!"; …
wakedeer
  • 493
  • 5
  • 14