I am developing a modular java project with java/javafx 12 in Eclipse 2019-06, using a mixed modular and non-modular approach. Cannot get the program to run because of exceptions at runtime.
I need to use a mixed modular and non-modular approach because the program requires external libraries. Most of them are available as modules, but jOpenDocument is not provided as a module by the developers.
I get no complains from Eclipse, except "Name of the automatic module jOpenDocument is unstable", which should not be the problem.
When I launch the program I get the following exception:
Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for C:\Users\ct\eclipse-workspace-2019-06\DMModule2\lib\jOpenDocument-1.4rc2.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: JDOMAbout$Info.class found in top-level directory (unnamed package not allowed in module)
I have all the external jars in the module path, the module-info file is shown here below.
The project can run smoothly using a non-modular approach, but I would like to stay with modules. I found these two references for the same kind of problem
Mixed Modular and Non-Modular Development in Eclipse using Java 11
What do I need to build JDK 9 project with non-modular dependencies using Maven
but did not help me to solve.
The source code for jOpenDocument is available https://jopendocument.org/download/jOpenDocument-src-1.4rc2.zip, so updating the jar to a module by adding the module-info file is feasible. I tried that as well but without success, if anybody can do it that would helpful for the community I think.
module dmmodule2 {
exports dmmodule;
exports gui;
// sql
requires transitive java.sql;
// Json
requires transitive org.glassfish.java.json;
// jOpenDocument
requires transitive jOpenDocument;
// JavaFX;
requires javafx.fxml;
requires transitive javafx.graphics;
requires transitive javafx.controls;
opens dmmodule to javafx.fxml;
opens gui to javafx.fxml;
}
Is anybody so kind to give a hint to make my modular project to work by either using the available jOpenDocument binary jar of by converting it to a module from source code?