因此,当我试图通过另一个类MainFX运行gui时,我遇到了一些错误(我将尝试解决这些错误,但这并不是这个问题的意义所在):
Caused by: java.lang.IllegalAccessError: class com.sun.javafx.fxml.FXMLLoaderHelper (in unnamed module @0x71b9e075) cannot access class com.sun.javafx.util.Utils (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.util to unnamed module @0x71b9e075
at com.sun.javafx.fxml.FXMLLoaderHelper.<clinit>(FXMLLoaderHelper.java:38)
at javafx.fxml.FXMLLoader.<clinit>(FXMLLoader.java:2056)
at app.control.MainControl.loadFXML(MainControl.java:22)
at app.MainFX.start(MainFX.java:42)
正是在这一点上,我尝试添加一个module-info.java,并解决了IntelliJ捕获的所有导入依赖项,添加了一些模块依赖项:
module bartest {
requires com.google.common;
requires javafx.controls;
requires javafx.graphics;
requires javafx.fxml;
requires flogger;
requires java.logging;
requires java.persistence;
opens app;
}
Information:java: compiler message file broken: key=compiler.misc.msg.bug arguments=11.0.4, {1}, {2}, {3}, {4}, {5}, {6}, {7}
Information:java: java.lang.module.ResolutionException: Module jakarta.activation contains package javax.activation, module java.activation exports package javax.activation to jakarta.activation
Information:java: at java.base/java.lang.module.Resolver.resolveFail(Resolver.java:885)
Information:java: at java.base/java.lang.module.Resolver.failTwoSuppliers(Resolver.java:789)
Information:java: at java.base/java.lang.module.Resolver.checkExportSuppliers(Resolver.java:718)
Information:java: at java.base/java.lang.module.Resolver.finish(Resolver.java:362)
Information:java: at java.base/java.lang.module.Configuration.<init>(Configuration.java:130)
Information:java: at java.base/java.lang.module.Configuration.resolveAndBind(Configuration.java:484)
Information:java: at java.base/java.lang.module.Configuration.resolveAndBind(Configuration.java:288)
Information:java: at jdk.compiler/com.sun.tools.javac.file.JavacFileManager.getServiceLoader(JavacFileManager.java:985)
Information:java: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Information:java: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Information:java: at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Information:java: at java.base/java.lang.reflect.Method.invoke(Method.java:566)
Information:java: at org.jetbrains.jps.javac.JavacMain$2.invoke(JavacMain.java:290)
Information:java: at com.sun.proxy.$Proxy24.getServiceLoader(Unknown Source)
Information:java: at com.sun.proxy.$Proxy25.getServiceLoader(Unknown Source)
Information:java: at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.initProcessorLoader(JavacProcessingEnvironment.java:261)
Information:java: at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.<init>(JavacProcessingEnvironment.java:237)
Information:java: at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.instance(JavacProcessingEnvironment.java:193)
Information:java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.initProcessAnnotations(JavaCompiler.java:1136)
Information:java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:922)
Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
Information:java: at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:195)
Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:460)
Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:330)
Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:255)
Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:213)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1324)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1004)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1071)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:965)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:794)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:376)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:178)
Information:java: at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:139)
Information:java: at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:288)
Information:java: at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:121)
Information:java: at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:228)
Information:java: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
Information:java: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
Information:java: at java.base/java.lang.Thread.run(Thread.java:834)
Information:java: Errors occurred while compiling module 'bartest'
Information:javac 11.0.4 was used to compile java sources
Information:29/08/2019 4:03 a. m. - Build completed with 1 error and 0 warnings in 4 s 405 ms
Error:java: Compilation failed: internal java compiler error
所以我的module-info.java不能编译,如果没有module-info.java文件,我就不能运行JavaFX,这可能在没有module-info.java文件的情况下就可以解决,但是我想知道是什么导致了这个问题,而且您可以告诉我,我对大多数这方面的概念(maven,jpa,模块化)还很陌生,我本次测试的目标是学习,所有的帮助将非常感谢。
我认为可能影响的其他因素是我对maven pom.xml文件缺乏经验,我基本上让Intellij生成依赖项和我在internet上搜索的插件标签,但可能是错误的
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>bartest</artifactId>
<groupId>com.kurama</groupId>
<modelVersion>4.0.0</modelVersion>
<version>1.0-SNAPSHOT</version>
<name>J_HibernateDaggerTest</name>
<url>http://maven.apache.org</url>
<properties>
<java.version>11.0.4</java.version>
<hibernate.version>5.3.11.Final</hibernate.version>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>${java.version}</release>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
<groupId>org.apache.maven.plugins</groupId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<configuration>
<mainClass>app.MainFX</mainClass>
</configuration>
<version>0.0.3</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>6.2</version>
</dependency>
</dependencies>
<configuration>
<forkCount>0</forkCount>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<artifactId>javafx-controls</artifactId>
<groupId>org.openjfx</groupId>
<version>11.0.2</version>
</dependency>
<dependency>
<artifactId>javafx-fxml</artifactId>
<groupId>org.openjfx</groupId>
<version>11.0.2</version>
</dependency>
<dependency>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
<version>LATEST</version>
</dependency>
<dependency>
<artifactId>mariadb-java-client</artifactId>
<groupId>org.mariadb.jdbc</groupId>
<version>2.4.2</version>
</dependency>
<dependency>
<artifactId>flogger</artifactId>
<groupId>com.google.flogger</groupId>
<version>0.4</version>
</dependency>
<dependency>
<artifactId>flogger-system-backend</artifactId>
<groupId>com.google.flogger</groupId>
<version>0.4</version>
</dependency>
<dependency>
<artifactId>controlsfx</artifactId>
<groupId>org.controlsfx</groupId>
<version>11.0.0</version>
</dependency>
<dependency>
<artifactId>jfxtras-controls</artifactId>
<groupId>org.jfxtras</groupId>
<version>10.0-r1</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
</dependency>
</dependencies>
</project>
编辑1:
此处用户Gili指出:
“Eclipse foundation已接管JavaEE开发。javax.activation
已转移到jakarta.activation
中,请参阅wiki.eclipse.org/new_maven_coordines。”
所以我试着在我的pom中添加以下DEP
<dependency>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>jakarta.transaction</groupId>
<artifactId>jakarta.transaction-api</artifactId>
<version>1.3.1</version>
</dependency>
Error:java: java.lang.module.ResolutionException: Modules java.activation and jakarta.activation export package javax.activation to module error.prone.annotations
Information:java: java.lang.module.ResolutionException: Modules jakarta.activation and java.activation export package javax.activation to module javafx.webEmpty
Information:java: Errors occurred while compiling module 'bartest'
Information:javac 11.0.4 was used to compile java sources
Information:29/08/2019 4:03 a. m. - Build completed with 1 error and 0 warnings in 4 s 405 ms
Error:java: Compilation failed: internal java compiler error
这个补丁代码垫已经赶上了我...出于文件的原因,我在这里解释一下
在https://stackoverflow.com/A/48136912/11970095之后添加了
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
</dependency>
删除这个功能解决了一个大问题,唯一缺少的是module-info.java,在修复所需模块之后,该模块现在看起来如下所示
module bartest {
requires com.google.common;
requires javafx.controls;
requires javafx.graphics;
requires javafx.fxml;
requires flogger;
requires java.logging;
requires net.bytebuddy;
requires java.sql;
requires java.xml.bind;
opens app.control to javafx.fxml;
opens app.model to org.hibernate.orm.core;
opens app;
}
稳定性: 2 - 稳定的 Node.js 有一个简单的模块加载系统。 在 Node.js 中,文件和模块是一一对应的(每个文件被视为一个独立的模块)。 例子,假设有一个名为 foo.js 的文件: const circle = require('./circle.js'); console.log(`半径为 4 的圆的面积是 ${circle.area(4)}`); 在第一行中,foo.js 加
主要内容:语法,实例,实例,Ruby require 语句,语法,实例,Ruby include 语句,语法,实例,Ruby 中的 Mixins,实例模块(Module)是一种把方法、类和常量组合在一起的方式。模块(Module)为您提供了两大好处。 模块提供了一个命名空间和避免名字冲突。 模块实现了 mixin 装置。 模块(Module)定义了一个命名空间,相当于一个沙盒,在里边您的方法和常量不会与其他地方的方法常量冲突。 模块类似与类,但有以下不同: 模块不能实例化 模块没有子类 模块只能
我正在构建一个java应用程序,但每次我想导出到jar文件的终端显示此错误,我的jar文件是不可执行的。但是,如果我运行VS代码,它不会显示任何错误。这是我得到的错误,当我要导出到jar文件 在我的发布会上。json{} } 如果我在src文件中创建module-info.java,则会出现错误 javafx.controls不能解析为模块
重复类android。支持v4。应用程序。在模块类中找到INotificationSideChannel。jar(androidx.core:core:1.1.0)和类。jar(com.android.support:support-v4:23.4.0)
问题内容: 我正在尝试运行脚本,但始终收到此错误: 我该如何解决? 问题答案: 我遇到了同样的问题,我在同一文件夹中创建了一个文件,名为requests.py。因此,它实际上是在导入该文件,而不是实际上在请求您使用pip安装。然后,我创建的名为logging.py的文件出现了另一个问题。我都重命名了,问题解决了。听起来像是同样的问题…
我正在尝试使用 Angular 创建一个网络应用程序,该项目编译时没有错误。执行时,浏览器显示一个空白页并返回此错误: 错误 错误: 未捕获(在promise中): 错误: 静态注入器错误(应用模块)[NgbDropdown - StaticInjectorError(平台:核心)[NgbDropdown - NullIn的错误:没有提供者的变更检测参考! 错误:StaticInjectorErr