I have added some Apache Spark dependencies to my JavaFX project, and now its broken.
Java SDK 11
Dependencies:

  • spark-sql_2.13(3.5.0)
  • Spark-core_2.13(3.5.0)
  • univocity-parsers(2.9.1)

我已经在MODULE-INFO.Java(使用Automatic-Module-Name属性编辑的 list 文件)中声明了它们

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] the unnamed module reads package org.apache.spark.unused from both org.apache.spark.sql and org.apache.spark.sqlapi
[ERROR] the unnamed module reads package org.apache.spark.sql.util from both org.apache.spark.sql and org.apache.spark.sqlapi
[ERROR] the unnamed module reads package org.apache.spark.sql.streaming from both org.apache.spark.sql and org.apache.spark.sqlapi
[ERROR] the unnamed module reads package org.apache.spark.sql from both org.apache.spark.sql and org.apache.spark.sqlapi
[ERROR] the unnamed module reads package org.apache.spark.sql.internal from both org.apache.spark.sql and org.apache.spark.sqlapi
[ERROR] the unnamed module reads package org.apache.spark.sql.execution.streaming from both org.apache.spark.sql and org.apache.spark.sqlapi
[ERROR] the unnamed module reads package org.apache.spark.sql.catalyst.util from both org.apache.spark.sql and org.apache.spark.sqlapi
[ERROR] the unnamed module reads package org.apache.spark.sql.catalyst.plans.logical from both org.apache.spark.sql and org.apache.spark.sqlapi
[ERROR] the unnamed module reads package org.apache.spark.sql.catalyst.analysis from both org.apache.spark.sql and org.apache.spark.sqlapi
[ERROR] the unnamed module reads package org.apache.spark.unused from both org.apache.spark.sql and org.apache.spark.commonutils
[ERROR] the unnamed module reads package org.apache.spark.sql.catalyst.util from both org.apache.spark.sql and org.apache.spark.commonutils
[ERROR] the unnamed module reads package org.apache.spark.api.java.function from both org.apache.spark.sqlapi and org.apache.spark.commonutils
[ERROR] module org.apache.spark.sql reads package org.apache.spark.unused from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module org.apache.spark.sql reads package org.apache.spark.sql.catalyst.util from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module org.apache.spark.sql reads package org.apache.spark.api.java.function from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module org.apache.spark.sql reads package org.apache.spark.unused from both org.apache.spark.commonutils and org.apache.spark.sql
[ERROR] module org.apache.spark.sql reads package org.apache.spark.sql from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.apache.spark.sql reads package org.apache.spark.sql.util from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.apache.spark.sql reads package org.apache.spark.sql.streaming from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.apache.spark.sql reads package org.apache.spark.sql.internal from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.apache.spark.sql reads package org.apache.spark.sql.execution.streaming from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.apache.spark.sql reads package org.apache.spark.sql.catalyst.util from both org.apache.spark.commonutils and org.apache.spark.sql
[ERROR] module org.apache.spark.sql reads package org.apache.spark.sql.catalyst.plans.logical from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.apache.spark.sql reads package org.apache.spark.sql.catalyst.analysis from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module ojdbc10 reads package org.apache.spark.unused from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module ojdbc10 reads package org.apache.spark.sql.catalyst.util from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module ojdbc10 reads package org.apache.spark.api.java.function from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module ojdbc10 reads package org.apache.spark.unused from both org.apache.spark.commonutils and org.apache.spark.sql
[ERROR] module ojdbc10 reads package org.apache.spark.sql from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module ojdbc10 reads package org.apache.spark.sql.util from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module ojdbc10 reads package org.apache.spark.sql.streaming from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module ojdbc10 reads package org.apache.spark.sql.internal from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module ojdbc10 reads package org.apache.spark.sql.execution.streaming from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module ojdbc10 reads package org.apache.spark.sql.catalyst.util from both org.apache.spark.commonutils and org.apache.spark.sql
[ERROR] module ojdbc10 reads package org.apache.spark.sql.catalyst.plans.logical from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module ojdbc10 reads package org.apache.spark.sql.catalyst.analysis from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.json reads package org.apache.spark.unused from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module org.json reads package org.apache.spark.sql.catalyst.util from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module org.json reads package org.apache.spark.api.java.function from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module org.json reads package org.apache.spark.unused from both org.apache.spark.commonutils and org.apache.spark.sql
[ERROR] module org.json reads package org.apache.spark.sql from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.json reads package org.apache.spark.sql.util from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.json reads package org.apache.spark.sql.streaming from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.json reads package org.apache.spark.sql.internal from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.json reads package org.apache.spark.sql.execution.streaming from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.json reads package org.apache.spark.sql.catalyst.util from both org.apache.spark.commonutils and org.apache.spark.sql
[ERROR] module org.json reads package org.apache.spark.sql.catalyst.plans.logical from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.json reads package org.apache.spark.sql.catalyst.analysis from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module itextpdf reads package org.apache.spark.unused from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module itextpdf reads package org.apache.spark.sql.catalyst.util from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module itextpdf reads package org.apache.spark.api.java.function from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module itextpdf reads package org.apache.spark.unused from both org.apache.spark.commonutils and org.apache.spark.sql
[ERROR] module itextpdf reads package org.apache.spark.sql from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module itextpdf reads package org.apache.spark.sql.util from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module itextpdf reads package org.apache.spark.sql.streaming from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module itextpdf reads package org.apache.spark.sql.internal from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module itextpdf reads package org.apache.spark.sql.execution.streaming from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module itextpdf reads package org.apache.spark.sql.catalyst.util from both org.apache.spark.commonutils and org.apache.spark.sql
[ERROR] module itextpdf reads package org.apache.spark.sql.catalyst.plans.logical from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module itextpdf reads package org.apache.spark.sql.catalyst.analysis from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module EUSignJava reads package org.apache.spark.unused from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module EUSignJava reads package org.apache.spark.sql.catalyst.util from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module EUSignJava reads package org.apache.spark.api.java.function from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module EUSignJava reads package org.apache.spark.unused from both org.apache.spark.commonutils and org.apache.spark.sql
[ERROR] module EUSignJava reads package org.apache.spark.sql from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module EUSignJava reads package org.apache.spark.sql.util from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module EUSignJava reads package org.apache.spark.sql.streaming from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module EUSignJava reads package org.apache.spark.sql.internal from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module EUSignJava reads package org.apache.spark.sql.execution.streaming from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module EUSignJava reads package org.apache.spark.sql.catalyst.util from both org.apache.spark.commonutils and org.apache.spark.sql
[ERROR] module EUSignJava reads package org.apache.spark.sql.catalyst.plans.logical from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module EUSignJava reads package org.apache.spark.sql.catalyst.analysis from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.apache.commons.lang3 reads package org.apache.spark.unused from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module org.apache.commons.lang3 reads package org.apache.spark.sql.catalyst.util from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module org.apache.commons.lang3 reads package org.apache.spark.api.java.function from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module org.apache.commons.lang3 reads package org.apache.spark.unused from both org.apache.spark.commonutils and org.apache.spark.sql
[ERROR] module org.apache.commons.lang3 reads package org.apache.spark.sql from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.apache.commons.lang3 reads package org.apache.spark.sql.util from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.apache.commons.lang3 reads package org.apache.spark.sql.streaming from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.apache.commons.lang3 reads package org.apache.spark.sql.internal from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.apache.commons.lang3 reads package org.apache.spark.sql.execution.streaming from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.apache.commons.lang3 reads package org.apache.spark.sql.catalyst.util from both org.apache.spark.commonutils and org.apache.spark.sql
[ERROR] module org.apache.commons.lang3 reads package org.apache.spark.sql.catalyst.plans.logical from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.apache.commons.lang3 reads package org.apache.spark.sql.catalyst.analysis from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module com.fasterxml.jackson.databind reads package org.apache.spark.unused from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module com.fasterxml.jackson.databind reads package org.apache.spark.sql.catalyst.util from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module com.fasterxml.jackson.databind reads package org.apache.spark.api.java.function from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module com.fasterxml.jackson.databind reads package org.apache.spark.unused from both org.apache.spark.commonutils and org.apache.spark.sql
[ERROR] module com.fasterxml.jackson.databind reads package org.apache.spark.sql from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module com.fasterxml.jackson.databind reads package org.apache.spark.sql.util from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module com.fasterxml.jackson.databind reads package org.apache.spark.sql.streaming from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module com.fasterxml.jackson.databind reads package org.apache.spark.sql.internal from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module com.fasterxml.jackson.databind reads package org.apache.spark.sql.execution.streaming from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module com.fasterxml.jackson.databind reads package org.apache.spark.sql.catalyst.util from both org.apache.spark.commonutils and org.apache.spark.sql
[ERROR] module com.fasterxml.jackson.databind reads package org.apache.spark.sql.catalyst.plans.logical from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module com.fasterxml.jackson.databind reads package org.apache.spark.sql.catalyst.analysis from both org.apache.spark.sqlapi and org.apache.spark.sql
[ERROR] module org.apache.spark.sqlapi reads package org.apache.spark.unused from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module org.apache.spark.sqlapi reads package org.apache.spark.sql.catalyst.util from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module org.apache.spark.sqlapi reads package org.apache.spark.api.java.function from both org.apache.spark.commonutils and org.apache.spark.sqlapi
[ERROR] module org.apache.spark.sqlapi reads package org.apache.spark.unused from both org.apache.spark.commonutils and org.apache.spark.sql
[INFO] 100 errors 
[INFO] -------------------------------------------------------------

如何在运行和构建应用程序时解决这些问题?

推荐答案

有关类似错误的相关问题中的一些信息:

虽然你如何产生这个错误的确切原因将与答案中提到的原因不同.

无论你做了什么都是错的:

module-info.java内声明它们(具有Automatic-Module-Name属性的已编辑 list 文件)

在使用非模块化软件时,最简单的解决方案是使您的应用程序非模块化.

  1. 把你的module-info.java删掉.
  2. 将JavaFX放置在模块路径上:
    • 使用编译器switch 和VM参数将JavaFX放在模块路径上
    • 或者,使用包含JavaFX模块的JRE,例如BellSoft Full JDK.

非模块化的JavaFX应用程序的说明在getting started instructions at openjfx.io中.

我还推荐使用与您的IDE项目同步的现代Java和JavaFX版本(例如,21+)和构建工具(Maven或Gradle).

Java相关问答推荐

JPackage-results已安装-如何添加系统属性?

在Java 8之后,HashMap的最坏情况下时间复杂度仍然是O(n)而不是O(log n)?

如何使用jooq generator将表名和列名映射为人类可读的?

Java 21虚拟线程执行器的性能比池化操作系统线程的执行器差?

无法初始化JPA实体管理器工厂:无法确定为Java类型<;类>;推荐的JdbcType

如何解释Java中for-each循环中对Iterable的强制转换方法引用?

无法播放音频:从资源加载库GStreamer-Lite失败

为什么StandardOpenOption.CREATE不能通过Ubuntu在中小企业上运行?

如何使用MapStrCut转换双向链接

从泛型枚举创建EnumMap

如何处理两个几乎相同的XSD文件?

嘲笑黄瓜中的对象

为什么项目名称出现在我的GET请求中?

JavaFX:为什么我的ComboBox添加了一个不必要的单元格的一部分?

从字节数组切换到JakartaMail org.springframework.mail.javamail.JavaMailSender InputStreamResource

如何设置默认序列生成器分配大小

多线程、并发和睡眠未按预期工作

如何在Java中正确实现填字游戏求解器

如何组合Mono和Flux

JAVA 正则表达式识别字符串string或字符串内的字符char