InvocationTargetException when running a javafx program

Your MainController doesn’t have a zero-argument constructor. If the FXMLLoader encounters a fx:controller attribute on the root element, it attempts to create an instance of that controller by (effectively) calling the zero-argument constructor of the class specified in the attribute. To fix this (the simplest way), remove the fx:controller attribute from the FXML file, and … Read more

Error: JavaFX runtime components are missing, and are required to run this application with JDK 11

This worked for me: File >> Project Structure >> Modules >> Dependency >> + (on left-side of window) clicking the “+” sign will let you designate the directory where you have unpacked JavaFX’s “lib” folder. Scope is Compile (which is the default.) You can then edit this to call it JavaFX by double-clicking on the … Read more