Skip to content

Javafx fails to start in Intelij #663

@ennishol

Description

@ennishol

Jbang version 0.60.0

Tried jfx.java example on command line and it works, but not with Intelij:

jbang edit --open=idea --live jfx.java

and get the error:

.jbang/cache/projects/jfx.java_jbang_01809bfbfddbb84e2f783abac9790b5019cd22f549b149feb1a1990e1d6d7d46/jfx/src/jfx.java:18: error: cannot access EventTarget
        stage.setScene(scene);
             ^
  class file for javafx.event.EventTarget not found

Code

//DEPS org.openjfx:javafx-controls:14.0.2:${os.detected.jfxname}
//DEPS org.openjfx:javafx-graphics:14.0.2:${os.detected.jfxname}
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;


public class jfx 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();
    }

}```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions