gpt4 book ai didi

javafx - 任务 'run' 导致 : org. joor.ReflectException : java. lang.NoSuchFieldException: javaExecHandleBuilder - Gluon 移动项目

转载 作者:行者123 更新时间:2023-12-03 15:39:54 26 4
gpt4 key购买 nike

当我尝试在 NetBeans 中运行我的整个项目时,我收到以下错误日志:

...
Task :run FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':run'.
> org.joor.ReflectException: java.lang.NoSuchFieldException: javaExecHandleBuilder

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
我不知道发生了什么,我在 build.gradle 中指定了主类...请帮忙!

最佳答案

我找到了使用 Gradle 6.6 或更高版本开发 JavaFX 项目的解决方案。您需要删除 javafx-gradle-plugin 并使用 Gradle 本身的 JPMS 支持。删除 javafx-gradle-plugin 后,您需要自己维护 JavaFX 依赖项。这里是 build.gradle 的示例设置。

plugins {
id 'application'
}

def currentOS = org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.currentOperatingSystem;
def platform
if (currentOS.isWindows()) {
platform = 'win'
} else if (currentOS.isLinux()) {
platform = 'linux'
} else if (currentOS.isMacOsX()) {
platform = 'mac'
}

java {
modularity.inferModulePath = true
}

dependencies {
implementation "org.openjfx:javafx-base:15.0.1:${platform}"
implementation "org.openjfx:javafx-controls:15.0.1:${platform}"
implementation "org.openjfx:javafx-graphics:15.0.1:${platform}"
implementation "org.openjfx:javafx-fxml:15.0.1:${platform}"
}

application {
mainModule = 'com.your.module'
mainClass = 'com.your.package.Main'
}
在您的 module-info.java 上文件,您需要声明 require JavaFX 模块。
module com.your.module {

requires javafx.base;
requires javafx.controls;
requires javafx.graphics;
requires javafx.fxml;

opens com.your.package to javafx.fxml;

exports com.your.package;

}

关于javafx - 任务 'run' 导致 : org. joor.ReflectException : java. lang.NoSuchFieldException: javaExecHandleBuilder - Gluon 移动项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63997525/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com