4

I use Ubuntu 20.04 and i have 3 java versions installed:


  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-14-openjdk-amd64/bin/java      1411      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      manual mode
  2            /usr/lib/jvm/java-14-openjdk-amd64/bin/java      1411      manual mode
* 3            /usr/lib/jvm/java-14-oracle/bin/java             1091      manual mode
  4            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

Press <enter> to keep the current choice[*], or type selection number: 
$ java -version
java version "14.0.1" 2020-04-14
Java(TM) SE Runtime Environment (build 14.0.1+7)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)

When I try to run the jar program through the terminal java -jar ***.jar, I still get the error

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

And even when I change the version of Java, the error is still the same.

sudo apt-get install openjfx and sudo apt-get install openjfx-source - It doesn't work for me.

I do not understand how to install Java FX on Ubuntu 20.04. Do you have any advice for me? Please help.

Mixa
  • 41
  • 1
  • 1
  • 2
  • The simplest way for the latest versions is just to use Maven (or Gradle) to configure JavaFX as a dependency. The [OpenJFX docs](https://openjfx.io/openjfx-docs/) have instructions for each IDE, with or without Maven or Gradle. (Follow the "JavaFX and [your IDE]") link on the left. – James_D Jun 20 '20 at 13:41
  • Does this answer your question? [Install openJDK+openJFX 8 on Ubuntu 20](https://stackoverflow.com/questions/61783369/install-openjdkopenjfx-8-on-ubuntu-20) – topher217 Feb 16 '22 at 02:38

1 Answers1

3

JavaFX has been removed from JDK 11. So if are trying to run JavaFX app using JDK 11 or higher, you need to add all the JavaFX dependencies in your classpath. But if you try to run it with your Java 8, it may run just fine. Follow these instructions: https://openjfx.io/openjfx-docs/#install-javafx

arnabxm
  • 149
  • 7