0

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?

Naman
  • 27,789
  • 26
  • 218
  • 353
CT95
  • 107
  • 1
  • 11
  • `JDOMAbout$Info.class` move this class to a named package(instead of being in the `src` folder directly) if you can edit the source. – Naman Oct 09 '19 at 08:24
  • 1
    Hi Naman, thanks for your hint. I think I get your point: the binary jar has three classes in the base folder rather than in a package: `JDOMAbout$Info.class, JDOMAbout$Author.class, JDOMAbout.class `. For the moment I find very difficult to rebuild the package in Eclipse, it shows errors loading it as it is and the ant script fails. – CT95 Oct 09 '19 at 09:54

1 Answers1

0

It's a problem related to JDOM, we will see what we can do in the next version of jOpenDocument.

BluEOS
  • 576
  • 6
  • 13