Preface: I already have the latest version of Eclipse installed and have been using it without issue. I'm running into issues now, as we are supposed to implement JavaFX into future projects.
Here are the instructions I was given to follow:
Installing JavaFX If you have the latest version of Eclipse installed on your machine:
- In Eclipse, go to Help, Eclipse MarketPlace
- Search for “javafx” in the “Find” bar
- Click on “install” next to the “e(fx)clipse 3.7.0
- If a message pops up indicating an error, it is because you have other packages which will be overridden – this is OK, confirm these updates.
- Restart Eclipse when prompted
Creating a JavaFX Project In Eclipse, New > Project > JavaFX > JavaFX Project
Now, I have followed all of the above steps and I am unable to do anything as the default Main.java fails to compile and run due to the following error:
Error occurred during initialization of boot layer java.lang.module.FindException: Module javafx.controls not found
Now, there are a lot of red underlines in the code, and I'm pretty confident it has to do with the JavaFX libraries not being available.
I have googled and followed other sets of instructions from Stack Overflow and other resources, but they all pretty much deal with Java SE 11 and higher, and we are required to use Java SE 9.
Here is my current buildpath. Although the instructions were referring to Java SE 11, I did install some JavaFX .jar files and uploaded them under classpath as well ( not currently pictured as I removed them when it didn't fix the issue ).
I saw another set of instructions that said to edit the isModular setting under the JRE for Java 9, but when I typed in "javafx.controls" under the source module to add exports, it tells me "Module 'javafx.controls" is not provided by this build path entry.
CodePudding user response:
Thanks to everyone who attempted to help, I was able to get it to work and so I'll post the solution for anyone else who might run into this rare situation.
1. Install JDK 9.0.4 from Oracle.
2. Install Eclipse
3. Run Eclipse
4. Install e(fx)clipse 3.7.0
- Click Help > Eclipse Marketplace
- Search "JavaFX"
- Click "Install" on e(fx)clipse 3.7.0
5. Install JDK 9.0.4 in Eclipse
- Window > Preferences
- Search "Installed"
- Select "Installed JREs"
- Click "Add"
- Select "Standard VM"
- Click "Directory"
- Find the JDK Folder, "jdk-9.0.4" and Select It
- Click "Select Folder" Click "Finish"
6. Create a new JavaFX Project
- File > New > Project
- JavaFX > JavaFX Project
- Ensure JavaSE-9 is selected next to "Use an executed environment JRE:"
- Click "Finish"
7. Configure Build Path
- Right-click on Project
- Build Path > Configure Build Path
- Ensure Libraries is selected along the top row
- Click JavaFX SDK under Modulepath
- Click "Remove"
- Click "Classpath"
- Click "Add Libary..."
- Select "JavaFX SDK"
- Click "Next"
- Click "Finish"
- Select "JRE System Library [JavaSE-9]"
- Click "Remove"
- Click "Classpath"
- Click "Add Library..."
- Select "JRE System Library"
- Select either "Execution Environment: "JavaSE-9 (jre-9.0.4)" OR "Workspace default JRE (jre-9.0.4)
- Click Finish
8. Remove "Module-info.java"
- Expand your Project Folders in the "Package Explorer"
- Right-click on "Module-info.java"
- Click "Delete"