我正在使用Eclipse 2019-06中的java/javafx 12开发一个模块化的java项目,使用混合的模块化和非模块化方法。由于运行时出现异常,因此无法运行程序。
我需要使用混合的模块化和非模块化方法,因为该程序需要外部库。它们中的大多数都是以模块的形式提供的,但jOpenDocument并不是由开发人员提供的模块。
我没有收到任何来自Eclipse的抱怨,除了“自动模块jOpenDocument的名称不稳定”,这不应该是问题。
当我启动程序时,我得到了以下异常:
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)我在模块路径中有所有的外部jars,模块信息文件如下所示。
该项目可以使用非模块化方法顺利运行,但我希望继续使用模块。我为同一类问题找到了这两个参考文献。
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
但并没有帮我解决。
https://jopendocument.org/download/jOpenDocument-src-1.4rc2.zip提供了jOpenDocument的源代码,因此通过添加模块信息文件将jar更新为模块是可行的。我也尝试过,但没有成功,如果有人能做到这一点,我认为这将对社区有所帮助。
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;
}有没有人能给出一个提示,让我的模块化项目通过使用可用的jOpenDocument二进制jar或通过将其从源代码转换为模块来工作?
发布于 2019-10-09 21:35:04
这是一个与JDOM相关的问题,我们将看看在下一个版本的jOpenDocument中可以做些什么。
https://stackoverflow.com/questions/58299534
复制相似问题