How do I fix JavaFX runtime components are missing?

拜拜、爱过 提交于 2020-08-07 05:19:45

问题


I have the following installed on Ubuntu 18.04.1 LTS:

openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.1)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.1, mixed mode)

javafx.runtime.version=8.0.161
javafx.runtime.build=b00

However I try to run the sample java application that uses javafx I get the following error:

$ java -jar Untitled.jar 
Error: JavaFX runtime components are missing, and are required to run this application

I have tried to run it in Eclipse, Intelli, and in the terminal with the same error.

I have set the classpath

:~$ echo $CLASSPATH
/usr/share/java/openjfx/jre/lib/ext/jfxrt.jar:.

I have copied all of the javafx files to the current directory. I have tried everything I can find on the internet.

Does anyone know how to fix this?


回答1:


On Ubuntu 18.04 with openjdk-11-jre and openjfx installed you could use:

% java --module-path /usr/share/openjfx/lib --add-modules ALL-MODULE-PATH \
    -jar Untitled.jar

There is more information on how to run JavaFX programs at the openjfx.io site.



来源:https://stackoverflow.com/questions/52130548/how-do-i-fix-javafx-runtime-components-are-missing

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!