Integrate JavaFX Runtime with Eclipse for Java 11
Context:
With the release of Java 11, JavaFX was excluded, leading to an error when attempting to run JavaFX applications. This article provides a step-by-step guide to incorporate JavaFX runtime into Eclipse in Java 11.
Solution:
-
Install Prerequisites: Obtain Eclipse 2018-09 and JDK 11.
-
Add Java 11 JRE: Within Eclipse, go to Windows -> Preferences -> Java -> Installed JREs and add Java 11.
-
Download JavaFX: Acquire JavaFX 11 from its official website.
-
Create User Library: In Eclipse, navigate to Windows -> Preferences -> Java -> Build Path -> User Libraries -> New. Establish a library named JavaFX11 and incorporate the jars from JavaFX 11's lib directory.
-
Create Java Project: Set up a new Java project and add the JavaFX11 library to the project's modulepath.
-
Add JavaFX Classes: Within a created package, import and utilize JavaFX classes as needed.
-
Configure Runtime Arguments: Edit the project's run configuration and add the following VM arguments:
- --module-path
- --add-modules=javafx.controls
-
Execute the Project: Run the project to ensure JavaFX functionality.
With these steps, users can seamlessly add JavaFX runtime to Eclipse in Java 11, enabling them to develop and execute JavaFX applications.
The above is the detailed content of How to Integrate JavaFX Runtime with Eclipse for Java 11?. For more information, please follow other related articles on the PHP Chinese website!