


Go through this step for each new Java FX project to be built. Note, it is important that the JavaFX SDK is installed in a location without spaces in the path so C:/Program Files is not a good choice. This assumes you have Eclipse with the E(FX)clipse plug in set up and an installation of the JavaFX SDK. Using Carlao2005's advice I was able to put together a complete guide for getting JavaFX to work in Eclipse now that JavaFX does not come with the Java SDK. Of course, you should download the JavaFX SDK before that ( ), unzip it and use the path to "lib" folder in the aforementioned VM argument.

The last step is to add a VM argument to "Run Configuration" of your JavaFX class for starting the application (Run Configurations -> Arguments tab -> VM arguments): -module-path C:\path to the OpenJFX\javafx-sdk-11.0.1\lib -add-modules=ntrolsĪnd it should work after you run it. The next step is to delete the "JavaFX SDK" from the "Classpath" module (Properties -> Java Build Path -> Libraries) and add the Maven dependency in order to remove compile errors: So, after you download the IDE ( ) and install the e(fx)clipse plugin, you should be able to create a "JavaFx Project" item in your workspace. I have tested it with the Eclipse release 2018-12. So actually for all 4 methods described above I needed to add Pereda is perfectly right, everything works as it should. The solution is to add the following VM arg: =C. on Windows, having a default JDK 8 in the system), there is a known issue regarding launching javafx. If this is your case, then make a new class with a main() function that does e.g.: Application.launch(MyApplication.class) this) that your main app SHOULD NOT extend Application (e.g. The javafx libs will of course still need to be in your classpath (but this is handled by mvn). Your application can work out of the box, without touching -module-path. This is la piece de résistence, which I found by mistake, after about 5h of Java 11 & modules "fun". 2b) Launch using Eclipse WITHOUT specifying -module-path Doing this would make the launch config not easily reusable by colleagues. Because otherwise you should have needed to write exactly the path towards the javafx jar, that are somewhere in your. Public class HelloFX extends Application void start(Stage stage) variable. Make sure that you select Java 11 and you add the JavaFX11 library to the project's modulepath.Īdd a package javafx11 and the main application class HelloFX: You don't need to add a module-path class. Name it JavaFX11 and include the jars under the lib folder from JavaFX 11-ea.Ĭreate a Java project. Following the getting started guide, these are the required steps to run JavaFX 11 from Eclipse.Īdd Java 11 as an installed JRE to Eclipse: Eclipse -> Window -> Preferences -> Java -> Installed JREs -> Add.Ĭreate a User Library: Eclipse -> Window -> Preferences -> Java -> Build Path -> User Libraries -> New.
