Error: JavaFX runtime components are missing, and are required to run this application with Gradle e

简介: Error: JavaFX runtime components are missing, and are required to run this application with Gradle e

Stack Overflow 堆栈溢出

Products 产品

Search…

Maynor 女名女子名

1

, 1 reputation 1声誉

Home 家

PUBLIC 公众人士

Questions 问题

Tags 标签

Users 用户

COLLECTIVES 集体

Explore Collectives 探索集体

FIND A JOB 找工作

Jobs 乔布斯

Companies 公司

TEAMS 团队

Create free Team 创建免费团队

Error: JavaFX runtime components are missing, and are required to run this application with Gradle example 错误: JavaFX 运行时组件丢失,需要用 Gradle 示例运行此应用程序

Asked 问道 1 year, 9 months ago 一年零九个月前

Active 活跃 1 year, 9 months ago 一年零九个月前

Viewed 观看 367 times 367次

1

I know this has been asked multiple times… but I can’t seem to find a solution.

我知道这个问题已经被问过很多次了… … 但是我似乎找不到解决办法。

Taken from this official guidelines example: https://openjfx.io/openjfx-docs/#gradle I went on and added in my build.gradle :

从这个官方指导方针的例子中可以看出: 我继续在我的建筑中添加了一些 https://openjfx.io/openjfx-docs/#gradle :

plugins {
id ‘application’
id ‘org.openjfx.javafxplugin’ version ‘0.0.8’
}
javafx {
version = ‘13’
modules = [‘javafx.controls’]
}
repositories {
mavenCentral()
}
mainClassName = “MyImage”
jar {
manifest {
attributes “Main-Class”: “$mainClassName”
}
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}

which, by running gradle jar (or gradle build), should actually produce a jar which should include all the packages it builds it with, that is the entire javafx library.

通过运行 gradle jar (或 gradle build) ,实际上应该生成一个 jar,其中应该包含所有构建它的包,即整个 javafx 库。

However, when it builds successfully and then I proceed with running:

然而,当它构建成功后,我继续跑步:

java -jar build/libs/MyImage.jar

Java-jar build/libs/MyImage.jar

it still throws the error:

它仍然会抛出错误:

Error: JavaFX runtime components are missing, and are required to run this application

错误: JavaFX 运行时组件丢失,并且需要运行此应用程序

What am I missing?

我错过了什么?

(I use JDK 11)

(我使用 JDK 11)

Many Thanks.

非常感谢。

gradle “ gradle”的复数

javafx

Share 分享

Edit 编辑

Follow 跟着

asked 问Jan 16 '20 at 14:03 1月1620日14:03

Eos Antigen Eos 抗原

16811 silver badge 1枚银色徽章1010 bronze badges 10枚铜章

Add a comment 添加评论

1 Answer 1. 回答

3

In Java 11 the Java launcher detects that you’re extending javafx.application.Application and checks the modules are present. If you’re using plain old JARs then you’ll get the error

在 java11中,Java 启动器检测到您正在扩展 javafx.application。应用程序和检查模块是否存在。如果您使用的是普通的旧罐子,那么您将得到错误

Error: JavaFX runtime components are missing, and are required to run this application

You have two choices. Setup your application to use the Java module system or the following workaround.

您有两个选择。将应用程序设置为使用 Java 模块系统或下列变通方法。

This workaround avoids the Java launcher check and will let the application run.

这个解决方案避免了 Java 启动器检查,并且允许应用程序运行。

public class MyImage { // <=== note - does not extend Application

public static class YourRealApplication extends Application {
    @Override
    public void start(Stage primaryStage) throws Exception {
        // whatever...
    }
}
public static void main(String[] args) {
    Application.launch(YourRealApplication.class);
}

}

Share 分享

Edit 编辑

Follow 跟着

answered 回答Jan 16 '20 at 14:12 1月1620日14:12

Adam 亚当

33.6k 33.6 k88 gold badges 8枚金徽章9292 silver badges 92枚银徽章128128 bronze badges 128枚铜章

Add a comment 添加评论

Your Answer

你的答案

Not the answer you’re looking for? Browse other questions tagged 不是你想要的答案? 浏览其他标记的问题gradle “ gradle”的复数 javafx or 或ask your own question 问你自己的问题.

The Overflow Blog 溢出博客

Why solve a problem twice? Design patterns let you apply existing solutions… 为什么要两次解决一个问题? 设计模式让你应用现有的解决方案…

Podcast 384: Can AI solve car accidents and find you a parking space? 播客384: 人工智能能解决交通事故并为你找到停车位吗?

Upcoming Events 即将举行的活动

2021 Community Moderator Election 2021年社区主持人选举

ends 结束Oct 26 10月26日

Featured on Meta 上的精选

Version labels for answers 答案的版本标签

Planned SEDE maintenance scheduled for Oct 15, 2021 and Oct 16, 2021… 计划于2021年10月15日和2021年10月16日进行的 SEDE 维护…

2021 Community Moderator Election 2021年社区主持人选举

Hot Meta Posts 热门文章

4

How can we disambiguate the tag [json-value]? 我们如何消除标签[ json-value ]的歧义?

8

Should we accept tag wiki excerpts with co-tagging guidelines? 我们是否应该接受带有协同标签指南的标签 wiki 摘录?

Linked

链接

0

Cannot set up JavaFX in VSCode 无法在 VSCode 中设置 JavaFX

Related

相关阅读

372

How do I tell Gradle to use specific JDK version? 我如何告诉 Gradle 使用特定的 JDK 版本?

0

Java 9 and JavaFX on Fedora 27 “runtime components are missing” 在 Fedora 27上的 java9和 JavaFX“缺少运行时组件”

43

JavaFX 11 : Create a jar file with Gradle 11: 用 Gradle 创建一个 jar 文件

3

JavaFX 11: “JavaFX runtime components are missing” JavaFX 11: “ JavaFX 运行时组件丢失”

0

Running a simple javafx application with gradle project in eclipse 在 eclipse 中使用 gradle 项目运行简单的 javafx 应用程序

1

Can’t build javafx project with gradle in intellij idea 在 intellij 思想中不能用 gradle 构建 javafx 项目

1

JavaFX runtime components are missing (Eclipse) 缺少 JavaFX 运行时组件(Eclipse)

Hot Network Questions 热点网络问题

What is this hook on a strike/panic door? 这个安全门上的钩子是什么?

Are berries allowed to be sold with 60% “mold count” in the United States? 在美国,是否允许以60% 的霉菌数量出售浆果?

Do I have to submit my high school transcript if “transcripts for all current and previous post-secondary study” are required? 如果需要“所有现在和以前的专上学习成绩单”,我是否必须提交我的高中成绩单?

Why did Kang choose Loki as a possible successor? 为什么康选择洛基作为可能的继承人?

The meaning of “for a million bucks” in this sentence 这句话中“为了一百万美元”的意思

more hot questions 更多热点问题

Question feed 问题提要

STACK OVERFLOW 堆栈溢出

Questions 问题

Jobs 乔布斯

Developer Jobs Directory 开发人员职位目录

Salary Calculator 薪金计算机

Help 救命

Mobile 移动设备

PRODUCTS 产品

Teams 团队

Talent 人才

Advertising 广告

Enterprise 企业

COMPANY 公司

About 关于

Press 新闻稿

Work Here 在这里工作

Legal 法律

Privacy Policy 私隐政策

Terms of Service 服务条款

Contact Us

Cookie Settings

Cookie Policy

STACK EXCHANGE

NETWORK 网络

Technology 技术

Life / Arts 生活/艺术

Culture / Recreation 文化/康乐

Science 科学

Other 其他

Blog 博客

Facebook 脸谱网

Twitter 推特

LinkedIn

Instagram 图片分享

site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.10.14.40466

x1.00


目录
相关文章
|
7月前
|
SQL 人工智能 移动开发
Android Studio插件版本与Gradle 版本对应关系
Android Studio插件版本与Gradle 版本对应关系
Android Studio插件版本与Gradle 版本对应关系
|
8月前
|
存储 Java Android开发
Android 开发 - 充分利用Gradle
Android 开发 - 充分利用Gradle
112 2
|
缓存 Android开发
Android Studio中如何清理gradle缓存
Android Studio中如何清理gradle缓存
|
Android开发
Android Studio中修改gradle插件版本和Gradle版本
Android项目中,我们一般要设置gradle插件版本和gradle版本。 项目根目录下的build.gradle文件中,通过classpath可以指定gradle插件的版本。
|
Java Android开发
Android如何通过Gradle发布Android依赖库(aar)到 jitpack 公共仓库
Android如何通过Gradle发布Android依赖库(aar)到 jitpack 公共仓库
492 0
|
5月前
|
开发工具 Android开发 开发者
Android 项目编译 Gradle 配置说明
Android 项目编译 Gradle 配置说明
155 0
|
6月前
|
Java Maven Android开发
android之gradle配置仓库与引入依赖
android之gradle配置仓库与引入依赖
240 0
|
8月前
|
Java 开发工具 Maven
Android 编译 gradle 内存 OOM 解决之路(二)
Android 编译 gradle 内存 OOM 解决之路
|
8月前
|
Java Android开发
Android 编译 gradle 内存 OOM 解决之路(一)
Android 编译 gradle 内存 OOM 解决之路
|
存储 缓存 IDE
Android Studio 3.1.3 Gradle同步错误无法下载Gradle-Core.jar
Android Studio 3.1.3 Gradle同步错误无法下载Gradle-Core.jar
444 0