Error: JavaFX runtime components are missing, and are required to run this application in eclipse
I am a beginner in JavaFX and trying to run JavaFX in Eclipse on Ubuntu.
I have openjfx installed on my pc, but it is giving the error
JavaFX runtime components are missing, and are required to run this application.
I have searched a lot but not got any solution.
2 Answers 2
Try simply creating a launcher.
For your App, it should look something like this:
(you can leave the old main Method unused in your App for the time-being)
This worked for me with JDK 13 & JavaFX 13 & Eclipse 2019-12 under Ubuntu.
(I created the Project using «new/Maven Project/Simple Project» and then just added JavaFX, Logging & other stuff as dependencies in pom.xml, which all landed on the Classpath. Only the JDK was on the Modulepath)
No need to bother about Java Modules.
If that works, you can take time to learn about Java Modularisation another day.
The suggestion from Venkata Raju brought me already half the way with Eclipse (2019-03 with Java 11):
Maven Shade JavaFX runtime components are missing
I’m trying to create a JFX11 self-containing jar using maven dependencies. From the research I’ve done, it seems the best way to do this is through the maven shade plugin. However, When I run it, I get the this error:
Error: JavaFX runtime components are missing, and are required to run this application
I don’t understand why this is happening. What am I messing up? Is there a better way to do this? I’ve also tried the maven assembly plugin with the same message.
pom file for reference
1 Answer 1
UPDATE 10/2021
Since JavaFX 16 a warning is displayed when JavaFX doesn’t run on the module path, which is the case of an uber/fat jar:
Also, you get a warning from the shade plugin itself:
While these warnings can be initially ignored, there is a reason for them.
As explained in this CSR:
JavaFX is built and distributed as a set of named modules, each in its own modular jar file, and the JavaFX runtime expects its classes to be loaded from a set of named javafx.* modules, and does not support loading those modules from the classpath.
when the JavaFX classes are loaded from the classpath, it breaks encapsulation, since we no longer get the benefit of the java module system.
ORIGINAL ANSWER
This answer explains why a fat/uber jar fails on JavaFX 11. In short:
This error comes from sun.launcher.LauncherHelper in the java.base module. The reason for this is that the Main app extends Application and has a main method. If that is the case, the LauncherHelper will check for the javafx.graphics module to be present as a named module. If that module is not present, the launch is aborted.
And already proposes a fix for Gradle.
You will have new class in your application package (bad name):
And your existing Main class, as is:
Now you need to modify your pom and set your main class for the different plugins:
Platform-specific Fat jar
Finally, with the shade plugin you are going to produce a fat jar, on your machine.
This means that, so far, your JavaFX dependencies are using a unique classifier. If for instance you are on Windows, Maven will be using internally the win classifier. This has the effect of including only the native libraries for Windows.
JavaFX 11: «Отсутствуют компоненты среды выполнения JavaFX»
Я пытаюсь запустить образец кода JavaFX (взятый из 5-го издания Java Illuminated) под JavaFX 11 и Java 11, используя jGRASP 2 под Windows 10.
Я прочитал руководство «Начало работы с JavaFX» (https://openjfx.io/openjfx-docs /), и хотя я добился некоторого прогресса, я застрял.
Я загрузил последний ZIP-файл, распаковал его и обновил CLASSPATH, включив в него путь к файлам jar, необходимым для компиляции. Я могу успешно скомпилировать файл. Однако при попытке запустить я получаю следующее сообщение об ошибке:
Ошибка: отсутствуют компоненты времени выполнения JavaFX, и они необходимы для запуска этого приложения
В руководстве «Приступая к работе» говорится, что это можно исправить, добавив следующие параметры в вызов среды выполнения:
Я добавил параметры, но сообщение об ошибке все равно появляется.
Предыдущие статьи StackOverflow обычно заканчиваются указанным выше параметром; увы, я не могу понять, что еще делать.
2 ответа
Как первый пользователь, мне удалось заставить его работать, но для меня это было непросто.
Думаю, мало кто знаком с этой IDE, поэтому я опубликую шаги, которые я выполнил, в качестве базового руководства:
Загрузите и установите версию jGRASP 2.0.5_05 Бета.
Откройте образец класса HelloFX. Я начал с самого простого примера из документации OpenJFX. Код можно найти здесь.
Это было ожидаемо. Согласно документации, нам нужно установить аргументы module-path и add-modules.
Повторный запуск завершился неудачно с тем же сообщением об ошибке, что и выше, но с одним отличием в журнале консоли:
Если вы видите журнал консоли, он содержит именно ту команду, которую вы использовали бы при запуске в командной строке:
Попробуйте просто создать средство запуска только с основным методом. Это может выглядеть примерно так:
(вы можете пока оставить старый основной метод неиспользованным в вашем приложении)
У меня это сработало с JDK 13, JavaFX 13 и Eclipse 2019-12 под Ubuntu.
(Я создал проект, используя «new / Maven Project / Simple Project», а затем просто добавил JavaFX, Logging и другие вещи в качестве зависимостей в pom.xml, которые все попали в Classpath. Только JDK был в Modulepath) > Не нужно беспокоиться о модулях Java.
JavaFX 11: «JavaFX runtime components are missing»
I’m trying to run sample JavaFX code (taken from the 5th edition of Java Illuminated) under JavaFX 11 and Java 11, using jGRASP 2 under Windows 10.
I’ve read through the «Getting Started with JavaFX» guide (https://openjfx.io/openjfx-docs/) extensively, and while I’ve made some progress, I’m stuck.
I’ve downloaded the latest ZIP file, unpacked it, and updated the CLASSPATH to include a path to the jar files needed to compile. I can successfully compile the file. However, when I try to run, I get the following error message:
Error: JavaFX runtime components are missing, and are required to run this application
The «Getting Started» guide says that this can be fixed by adding the following options to the runtime call:
I’ve added the options, but I’m still getting the error message.
Previous StackOverflow articles usually end with the option setting above; alas, I can’t figure out what else to do.
2 Answers 2
As a first time user, I’ve managed to make it work, but it was not straightforward to me.
I guess there are no many people familiarized with this IDE, so I’m going to post the steps I followed, as a basic tutorial:
Download and install jGRASP version 2.0.5_05 Beta.
Open HelloFX sample class. I’ve started with the most basic sample from the OpenJFX docs. The code can be found here.
That was expected. According to the docs, we need to set the module-path and add-modules arguments.
running again failed with the exact same error message as above, but with one difference in the console log:
What’s wrong with that!? Well. if you try that on command line, it will fail as well, because the order of arguments is wrong, the vm arguments should go before the class name.
Luckily, next to the Environment tab, there is a Flags/Args tab, and there we can set our vm arguments in FLAGS2 :
If you see the console log, it contains exactly the command you would use when running on command line:
I guess the next step will be running a more complex project.
JavaFX runtime components missing (Gradle) #128
Comments
ong-yinggao98 commented Aug 31, 2020
I followed the tutorial for setting up JavaFX via Gradle, but I am unable to run the application as I get the following error:
JavaFX runtime components are missing, and are required to run this application
How do I resolve this?
The text was updated successfully, but these errors were encountered:
yongmingyang commented Aug 31, 2020
Hi, I ran into the same issue. I fixed this by downloading the javaFX 11 SDK and following the steps under «if you are not using Gradle». Hope it helps!
Nikhilalalalala commented Aug 31, 2020
Hi, I tried the aforementioned solution of following the steps under «if you are not using Gradle» as well, but I am still facing the issue, anyone managed to solve it?
Nikhilalalalala commented Aug 31, 2020
Okay, sorry, I realised I had to either change the main class in the build gradle file.
augustinekau commented Sep 1, 2020
Okay, sorry, I realised I had to either change the main class in the build gradle file.
Hi I am facing the same issue. Can you describe how do you do it? Thanks in advance.
yanbingtao commented Sep 1, 2020
Okay, sorry, I realised I had to either change the main class in the build gradle file.
Hi, I’m also having the same problem, do you mind to share more details? thanks in advance!
erisjacey commented Sep 1, 2020
Okay, sorry, I realised I had to either change the main class in the build gradle file.
@yanbingtao You could try the solution posed in #101. Hope this helps!
yanbingtao commented Sep 1, 2020 •
Okay, sorry, I realised I had to either change the main class in the build gradle file.
@yanbingtao You could try the solution posed in #101. Hope this helps!
Nikhilalalalala commented Sep 1, 2020
Hi more things that I checked are here:
The tutorial mentioned the use of a Launcher class, so the main class name has to be changed to «duke.Launcher» or whatever other name used.
Also, since the Launcher class has the main method, the main method in Duke needs to be removed.
One more thing is to follow the step 3 of the tutorial for those without gradle,
Find the configuration with gradle task run and add the above into the VM options of that particular configuration. Not sure if this is clear, do sound out for any further clarifications.
ong-yinggao98 commented Sep 1, 2020
I’ve dug around some more and found this link over here
javafxports/openjdk-jfx#236 (comment)












