How to add JavaFX to Eclipse (the easy way)

Step 1. Download JavaFX

Go to and download the appropriate SDK for your operating system. Make sure you download the SDK and make sure you choose the correct operating system and architecture for your computer. More than likely, you’ll be downloading one of the outlined options below.

Gluon download page for JavaFX SDK

This will install a .zip file. Unzip this file and put the resulting folder in a memorable place, such as your /Documents folder. We’ll need this later.

Step 2. Create a User Library in Eclipse

  • Open up Eclipse and go to Preferences
    • You should be able to get to Preferences from Eclipse > Preferences or Window > Preferences
  • Go to Java > Build Path > User Libraries
Eclipse, Preferences, Java, Build Path, User Libraries
  • Now click New…
Create a new User Library in Eclipse for JavaFX
  • Name it JavaFX and click Ok
  • With JavaFX highlighted, click Add External JARs…
Add External JARs for the new User Library in Eclipse
  • Select all the .jar files from the /lib/ folder of the unzipped JavaFX folder we saved earlier.
Add all the JavaFX JAR files to your JavaFX User Library
  • Click Open and your new User Library should look something like this:
New JavaFX JAR files added to the User Library
  • Click Apply and Close to save your new User Library

Step 3. Create a JRE clone with the required VM arguments

  • Go back to Preferences in Eclipse
  • Go to Java > Installed JREs
  • Select your default JRE and click Duplicate
Duplicate the default JRE in Eclipse
  • Copy this line if you’re on Windows
    • --module-path "\path\to\javafx-sdk-17\lib" --add-modules javafx.controls,javafx.fxml
  • Copy this line if you’re on Mac or Linux
    • --module-path /path/to/javafx-sdk-17/lib --add-modules javafx.controls,javafx.fxml
  • Important: Make sure you replace the /path/to/javafx-sdk-17/lib with the path to where you placed your unzipped JavaFX folder from before. You will want the entire path all the way to the /lib/ folder. For instance, mine on a Mac looks like this:
    • --module-path /Users/pragways/Documents/javafx-sdk-17.0.1/lib --add-modules javafx.controls,javafx.fxml
  • Paste that line in the Default VM arguments: field
  • Rename the JRE name: field to something memorable, such as javafx-jre-15
Add the JavaFX VM arguments
  • Click Add External JARs…
  • Select all the .jar files from the /lib/ folder of the unzipped JavaFX folder we saved earlier and then click Open
  • Your JRE Definition window should now look something like this
  • Click Finish

Step 4. Create a new project with your new JRE

Now whenever you want to create a new JavaFX project, it will be a lot quicker and easier!

All you need to do is make sure you select Use a project specific JRE when creating a new project, and then select your new JavaFX specific JRE that you just created.

Create a new Java project with a specific JRE for JavaFX.

Adam Allard

Hi, I'm Adam Allard. I'm a Full Stack Software Engineer for Northrop Grumman creating web applications for the DoD. At this time I'm primarily working with Java and Angular based applications, although I have some years of experience in various languages and frameworks from previous jobs where I dabbled with Python & Django, C# & Xamarin, PHP, and Bootstrap. My hobbies include time with my family, wondering when the Green Bay Packers will win their next Super Bowl, drinking over-priced beer, and of course learning and teaching.

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Posts