Tuesday, February 2, 2016

Eclipse can't launch JavaFx App

HelloWorldFx.java

import javafx.application.Application;
import javafx.stage.Stage;
public class HelloFx extends Application {
@Override
public void start(Stage stage) throws Exception {
stage.setTitle("First Hello World JavaFx");
stage.show();
}
}


This is because of you've not run anything before  (New Eclipse Configure)
This can be solved by adding main().

HelloWorldFx.java (Edited)
import javafx.application.Application;
import javafx.stage.Stage;
public class HelloFx extends Application {
public static void main(String[] args) {
Application.launch(args);
}
@Override
public void start(Stage stage) throws Exception {
stage.setTitle("First Hello World JavaFx");
stage.show();
}
}