If you need to have control over the moment JavaFX starts, you can use the Application.launch() method:
public static void main(String[] args) { // you custom code Application.launch(MyApplication.class, args);}
Here, MyApplication should extend javafx.application.Application.