Using Eclipse with JavaFX (with SceneBuilder, e(fx)clipse and fixed .fxml-Bug) on Linux

I wanted to use my Eclipse work environment on Linux, but if you look a bit into it you will see that there is a lot of tinkering needed to get everything working when it comes to JavaFX. Here I will document how I did it.

Limitations: You need to install Eclipse and the SceneBuilder on your system and you can NOT use the Eclipse Flatpak because there is a filesystem path/permission issue ans I use Arch Linux and the AUR here.

Now for the important part. How I did it:

  1. Install "eclipse-java" from the AUR
  2. Start Eclipse
  3. Go into Help >> Eclipse Marketplace >> Install e(fx)clipse
  4. Wait until everything is installed, and when it asks you to restart Eclipse, press "Restart Eclipse".
  5. Close Eclipse
  6. Install java-openjfx, java-openjfx-doc, java-openjfx-src
  7. Install javafx-scenebuilder from the AUR
  8. Open Eclipse and go into Window >> Preferences >> Java >> Build Path >> User Libraries
  9. Click "New" and call it "JavaFX"
  10. Select "JavaFX" and click "Add External JARs..."
  11. Go to "/usr/lib/jvm/java-20-openjdk-lib/" and select all .jar's by holding down Ctrl
  12. If the paths still show up corectly in Eclipse press "Apply and Close"
  13. Now go to Window >> Preferences >> JavaFX and click "Browse..." for the "SceneBuilder executable" and got to "/opt/scenebuilder/bin/" and select "SceneBuilder"
  14. "Apply" and "Apply and Close"
  15. Go to Help >> Install New Software >> Add >> Name = "e(fx)clipse nightly" and Location = "https://download.eclipse.org/efxclipse/updates-nightly/site/" >> Add >> Select everything >> Next >> Finish >> Wait until everything is installed, and when it asks you to restart Eclipse, press "Restart Eclipse".
  16. >> Eclipse is now properly configured. Now you need to configure your JavaFX project:

  17. Create a JavaFX-Project
  18. Now rightclick on the Project >> Properties >> Java Build Path >> Configute Build Path
  19. Select Libraries and select the "Modulepath" folder, Select "Add Library...", User Library, Select JavaFX and the click "Finish" and then "Apply" and "Apply and Close"
  20. Left click on your Project, then in the top bar press the arrow next to the 'Run Main' button and select 'Run Configurations'. Go to the "Arguments" tab and paste the following into "VM Arguments". Do the same for all the entries under "Java Application":

    --module-path /usr/lib/jvm/java-20-openjdk/lib --add-modules javafx.controls,javafx.fxml

  21. "Apply" and "Apply and Close"

NOTE: If you have a problem with your project where all the JavaFX stuff works except for javafx.fxml and Java complains that it is missing, just add the following to your "module-info.java" inside of your project:

requires javafx.fxml;


Now you should be able to use JavaFX inside your project, you should be able to create new .fxml files without error, use the Scenebuilder and compile your project in any way you like. Unfortunately, you have to add all the project configuration stuff to each new project you create, but it only takes a minute or two. How I could help you by documenting how I did it.


Sources: