JavaFX in Eclipse


1 Installation

1.1 Install e(fx)clipse

   open Eclipse Marketplace (in the Help menu) and search for fx

1.2 Install JavaFX

   https://gluonhq.com/products/javafx/

1.3 Create a user library for JavaFX

   - open Window / Preferences / Java / Build Path / User Libraries
   - click the New... button
   - enter JavaFX and confirm
   - click the newly created user library and then the Add External JARs... button
   - select all jar files from the lib folder of your JavaFX installation and click the Open button
   - click Apply and Close


2 Project Settings

2.1 Create a JavaFX project

   - use the Other... option from the new project menu
   - choose JavaFX / JavaFX project
   - remove all the contents of the src folder
   - copy the ogre and knights source files to the src folder


2.2 Add new JavaFX to the build path of your project and remove old JavaFX

   - add new JavaFX:
      - right click your project in the Project Explorer
      - choose Build Path / Configure Build Path
      - switch to the Libraries tab
      - select Classpath
      - click the Add Library... button
      - click the User Library
      - check JavaFX
  
   - remove old JavaFX:
      - select Modulepath
      - click JavaFX SDK
      - click the Remove button
   
   - click Apply and Close

2.3 Add JavaFX to the run configuration to your project

   - try to run your project in order to make Eclipse create a run configuration
   - open Run Configurations (available by unfolding the play buttton)
   - unfold Java Application and select your main class
   - switch to the Arguments tab
   - enter this line in the VM arguments field adjusting the path to JavaFX according to your own installation:

      --module-path "C:\Program Files\Java\javafx-sdk-17.0.1\lib" --add-modules javafx.controls,javafx.fxml
   
   - click the Apply button, and then the Close button


References

How to Set Up JavaFX to work in Eclipse | Newest 2020 version | JavaFX Beginner Tutorial, https://youtu.be/bC4XB6JAaoU


#17 Error Solved: JavaFX runtime components are missing, and are required to run this app | JavaFx, https://youtu.be/9R_JDwHikrU


How To Fix Error Occurred During Initialization Of Boot Layer, https://youtu.be/uF3VCQPUQO8


Valentino Vranić
vranic at stuba.sk