Home > Software engineering >  Java FX stage show function not working on mac
Java FX stage show function not working on mac

Time:03-14

I hope somebody will be able to help me with this : I'm on macOS and even though I put stage.show() at the end of my start method, when I run my program a strange "java" folder appears at the bottom but I can't open it nor close it

public class Main extends Application {


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

@Override
public void start(Stage primaryStage) throws Exception {
    
    Group root = new Group();
    Scene scene = new Scene(root);
    Stage stage = new Stage();
    
    
    stage.setScene(scene);
    stage.show();
}

}

Is there a way to fix this ?

CodePudding user response:

Instead of creating your own stage you should use the primaryStage provide to you. Why don't you just start with a working template from one of the many sources? And what is your stage going to show anyway? It contains just a scene with an empty group.

CodePudding user response:

After 5 hours of googling I found it. You need to go to Run->Run configurations->Argument and to uncheck "Use the -XstartOnFirstThread argument when launching with SWT"

  • Related