Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I fix JavaFX runtime components are missing?

Tags:

linux

javafx

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?

like image 440
Dang Avatar asked Sep 01 '18 17:09

Dang


People also ask

How do I fix JavaFX error?

If this is your case also, you can do fix this by simply right-clicking on the javaFX project folder-> Build Path-> Configure Build Path-> Select JavaFX SDK-> Remove library-> Select classpath -> add library-> user library-> select library-> apply. Show activity on this post. Installed jdk15.


1 Answers

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.

like image 193
jkoshy Avatar answered Oct 03 '22 20:10

jkoshy