JDK 8 comes with JavaFX. To install JDK 8 on your computer, download and install it here.
This page goes with this option. If you'll be using a recent JDK such as JDK 11 or higher, skip ahead to the Option 2 page.
Once you have JDK 8 installed, you need to tell Eclipse where to find it.
Go to the preferences menu option
Windows: Window → Preferences
Mac: Eclipse → Preferences
Go to Java → Installed JREs
Click on Add...
Confirm Standard VM is chosen and click next.
Click on the directory button to choose the java home location.
Windows
Java is most likely installed in C:\Program Files\Java
Select the jdk1.8.0...
folder.
Mac
In the menu bar at the top of the finder select Go → Go to Folder
In the box paste in the path: /Library/Java/JavaVirtualMachines/
Navigate into the folder for jdk 8 (something like jdk1.8.0_181.jdk
)
Open Contents and select the Home folder.
Click Finish
Check the box next to jre1.8.0 to make that the default JRE.
Click Apply and Close
Some versions of Eclipse require you to "enable" JavaFX when running Java 8. If you get an error saying "Access restriction: The type 'Application' is not API…"
then you need to follow the directions below to enable JavaFX in Eclipse. You must do this for each project that you want to use JavaFX.
This will enable JavaFX for the current project. You must do this for each project that uses JavaFX.
Last modified: March 01, 2023
Back to Check Your Java VersionDark Mode
Outline