Tag Archives: Ecliplse

Jdk11, using JavaFX in eclipse

Eclipse Version: 2018-12 (4.10.0)
JDK Version 11.0.2
Windows 64
First of all, the official documentation for JavaFX,
, is very detailed, and this article does not follow it exactly.
Download an appropriate JavaFX runtime Download an appropriate JavaFX runtime extract to folder (location not fixed but remember path), for example:
D:\openjfx-11.0.2_windows-x64_bin-sdk\javafx-sdk-11.0.2"
2. Ecliplse has been downloaded by default and Java11.0.2 development environment has been configured. Note that since Java11, the JDK and javaFX have been separated (there is no jre package for javaFX in the JDK after exporting the jre folder from the command line), so you don’t have to download a e(fx)clipse plug-in to use, you have to download and add it manually.
3. Create a User Library according to the official document. Include the jre under lib in the JavaFX runtime file downloaded before
Eclipse -> Window -> Preferences -> Java -> Build Path -> User Libraries -> New
next name is arbitrary, you can find the added FX lib in the Library when creating the project
4. Create a Java project, need three files, (someone else’s Github project link), and import a custom Library path.
5. The following problem occurs in the runtime. The solution mentioned in the official document is to add VM parameters
run-& gt; Run Configurations... select Main. Java is the Main class also click the Arguments TAB you can see the Arguments of the VM option, add the following parameters
- the module - the path "/ path/to \ \ lib" deployment headaches - SDK - 11 - add - modules deployment headaches. Controls, deployment headaches. FXML
Here, the path, to 11 \ lib \ deployment headaches - SDK - parameter is the path of the openjfx before download file decompression, such as
- the module - path "D: \ eclipse \ openjfx - 11.0.2 _windows x64_bin - SDK \ deployment headaches - SDK - 11.0.2 \ lib" - add - modules deployment headaches. Controls, deployment headaches. FXML
The successful running
The import Javafx cannot be resolved
JavaFX Runtime Components are missing, and are required to run this application
Problem 3. Error: The Main class Application.main cannot be initialized
As for the first problem, it is probably due to the
problem caused by running javaFX in the way of installing plug-ins when Java11 JDK and javaFX are separated at the beginning. If there is a problem with the import of Library package, check the path or go directly into the path to see if all of these jre files exist.