Java

Set up JavaFX

Update your Java #

Update your Java, please. Visit Oracle’s Java downloads page and choose your appropriate version. Ensure you note where you install it on your disk, as we will need to configure Eclipse later.

Install and configure JavaFX #

  1. Install JavaFX from openjfx.io. Remember the path where you unpacked the files to (i.e. on my machine: /Users/admin/eclipse-workspace/javafx-sdk-18.0.2/lib)
  2. Install e(fx)clipse (video walkthrough)
    1. Open Eclipse Marketplace.
    2. Search for ‘JavaFX’
    3. Install e(fx)clipse plugin
  3. Create a new user library where you add all jar files from /Users/admin/eclipse-workspace/javafx-sdk-18.0.2/lib. Call this library ‘JavaFX-Lib’ or something else you remember.

Create a new JavaFX project #

  1. File → New Project → JavaFX Project
  2. Make sure you remove e(fx)clipse plugin JavaFX SDK as it is an old version of JavaFX from your build path
  3. Add the user library you created in step 3 above (i.e. ‘JavaFX-Lib’) to your build path.

Remember when you run your new JavaFX Project to change its configuration to allow running JavaFX as follows:

Run Configuration → Arguments → VM Arguments

--module-path /Users/admin/eclipse-workspace/javafx-sdk-18.0.2/lib --add-modules=javafx.controls

You will need to uncheck ‘use The -XstartOnFirstThread argument when Launching with SWT’ at least on macOS.