I'm using IntelliJ IDEA and wrote a very basic JavaFX program (or really just started to write the program). When I run the program to check my GUI, then hit the X button to close the java window I get the following. If I code a button to say Platform.exit() it also gives me this code:
Process finished with exit code -1073741819 (0xC0000005)
I coded a button to call System.exit(0) and when I click it, it prints to the console that the exit button was clicked then says:
The Java SE Binary has stopped working.
I started up a fresh JavaFX project in Intellij IDEA and hit run to check the basic sample window it runs and that also exits with the exit code listed above.
I have the latest JDK installed (jdk1.8.0_121 64 bit), the latest version of scenebuilder from GluonHQ, and am running Windows 10 Pro x64.
Not sure what else to provide info wise, please let me know if you need more information.
Exit Button's code (fxid is the same in controller/.xml file). I plan to do a lambda in the future, still wrapping my head around those, but this should work as is, no?
exitButton.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent event)
{
System.out.println("You clicked exit!");
Platform.exit();
}
});
EDIT: This is the code that by itself is just the sample project IntelliJ IDEA creates when you start a new JavaFX project. With no tweaks at all I still get that exit code instead of 0 as expected, so something is happening independent of the code I wrote.
On sample.fxml
<?import javafx.geometry.Insets?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<GridPane fx:controller="sample.Controller"
xmlns:fx="http://javafx.com/fxml" alignment="center" hgap="10" vgap="10">
</GridPane>
on Controller.java
package sample;
public class Controller {
}
on Main.java
package sample;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
primaryStage.setTitle("Hello World");
primaryStage.setScene(new Scene(root, 300, 275));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}