Problems with JavaFX [missing components]

Hi,
I installed javaFx using the following command :
dnf install openjfx-devel
Then i tried to compile and to run with the following commands
javac -cp .:/usr/lib/jvm/openjfx/rt/lib/ext/jfxrt.jar HelloFX.java
java -cp .:/usr/lib/jvm/openjfx/rt/lib/ext/jfxrt.jar HelloFX
But when i execute the last command i have this weird error :
Erreur : des composants dexécution JavaFX obligatoires pour exécuter cette application sont manquants.
It’s in french but it says that some components are missing to run the application.
The code in the HelloFX.java (it comes from the official JavaFX documentation) :

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class HelloFX extends Application {

    @Override
    public void start(Stage stage) {
        String javaVersion = System.getProperty("java.version");
        String javafxVersion = System.getProperty("javafx.version");
        Label l = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
        Scene scene = new Scene(new StackPane(l), 640, 480);
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch();
    }

}

Thanks you in advance for your responses

1 Like

so i solved my problem, i’m just stupid. I didn’t use the right jdk. So i had to used the following command : sudo alternatives --config java to take the right jdk.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.