【问题标题】:ERREUR JAVA : Error occurred during initialization of boot layer java.lang.module.FindException: Module javafx.controls not foundERREUR JAVA:启动层 java.lang.module.FindException 初始化期间发生错误:找不到模块 javafx.controls
【发布时间】:2021-07-23 08:39:23
【问题描述】:

我尝试在 java eclipse (2020-12) 上安装 javafx (javafx-sdk-11.0.2),按照运行 javafx 项目的主代码所需的所有步骤,没有错误:添加用户类路径中的库和VM(--module-path "C:\javafx\javafx-sdk-11.0.2\lib" --add-modules = javafx.controls, javafx.fxml)但错误仍然存​​在展示。 enter image description here

images of the code

【问题讨论】:

  • 欢迎来到 SO!发帖前请阅读how-to-ask article。不要添加代码和错误的屏幕截图。

标签: java eclipse javafx


【解决方案1】:

我通过编辑运行配置“修复”了我在尝试从 Gluon Getting Started section for modular Eclipse projects 运行示例程序时出现的这个问题。

在 Dependencies 选项卡下,添加包含 JavaFX jar 文件的文件夹(jdk 的 /lib 子文件夹)。如果您检查生成的命令行,它现在应该在 -p 选项中包含该文件夹。

完成后,教程程序运行没有问题。

这引出了一个问题,为什么这个步骤甚至是必要的。 Eclipse “足够聪明”,可以自动将其他模块添加到依赖项中。如果在构建路径配置中指定了 JavaFX 库,为什么不使用它?为什么在 Gluon 教程中没有提到额外的运行配置依赖步骤?

我在 eclipse.org 和 gluon 上对此有未决问题。

【讨论】:

    猜你喜欢
    • 2021-08-31
    • 1970-01-01
    • 2019-02-24
    • 2019-05-16
    • 2019-05-07
    • 2021-05-17
    • 2019-12-31
    • 2021-07-01
    • 2021-10-03
    相关资源
    最近更新 更多