任务“运行"原因:org.joor.ReflectException:java.lang.NoSuchFieldException:javaExecHandleBuilder-Gluon移动项目 [英] Task 'run' causes: org.joor.ReflectException: java.lang.NoSuchFieldException: javaExecHandleBuilder - Gluon Mobile Project
问题描述
当我尝试在NetBeans中运行我的整个项目时,出现以下错误日志:
When I try to run my entire project in NetBeans I get the following error log:
...
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中指定了主类...请帮助!
I don't know what's going on, I specified the main class in build.gradle... Pls, help!
推荐答案
我找到了使用Gradle 6.6或更高版本开发JavaFX项目的解决方案.您需要删除javafx-gradle-plugin并使用Gradle本身的JPMS支持.删除javafx-gradle-plugin后,您需要自己维护JavaFX依赖项.这是 build.gradle
设置的示例.
I found a solution to develop JavaFX project with Gradle version 6.6 or newer. You need to remove the javafx-gradle-plugin and use the JPMS support from Gradle itself. With removing the javafx-gradle-plugin, you need to maintain the JavaFX dependencies by yourself. Here an example of the build.gradle
setup.
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模块.
On your module-info.java
file you need to declare the require JavaFX module.
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;
}
这篇关于任务“运行"原因:org.joor.ReflectException:java.lang.NoSuchFieldException:javaExecHandleBuilder-Gluon移动项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!