Getting JavaFX to work on Windows

Ever since JDK 11, JavaFX has been decoupled from the default Java JDK installer, so it has to be installed and configured separately. Here's how.

Install

Go to GluonHQ, scroll down to the most recent version, and do the download for “JavaFX Windows x64 SDK”. Copy the contents of the .zip file (not the .zip file itself) into C:\Program Files\Java\ (this Java folder should already exist). Now you should have a folder inside your Java folder. It should look like this (except with a bigger version number instead of 15):
Java folder containing javafx-sdk-15

Only have one instance of Textpad open (if there you have multiple copies of Textpad open, close them all except for one).

Whatever version of JavaFX you downloaded, enter it here (this is so you get the right command strings below)

21.0.1

In Textpad, go to menu: configure → Preferences, hit the + sign by tools, and select "Compile Java". Delete the "parameters" line and replace it with the following (click the text below and use ctrl-a and then ctrl-c to copy):

-cp .;"C:\Program Files\Java\javafx-sdk-15\lib\javafx.base.jar";"C:\Program Files\Java\javafx-sdk-15\lib\javafx.controls.jar";"C:\Program Files\Java\javafx-sdk-15\lib\javafx.fxml.jar";"C:\Program Files\Java\javafx-sdk-15\lib\javafx.graphics.jar";"C:\Program Files\Java\javafx-sdk-15\lib\javafx.media.jar";"C:\Program Files\Java\javafx-sdk-15\lib\javafx.swing.jar";"C:\Program Files\Java\javafx-sdk-15\lib\javafx.web.jar";"C:\Program Files\Java\javafx-sdk-15\lib\javafx-swt.jar" $File

The configuration menu should look something like this:

Image of Textpad, correctly configured to compile

Similarly, select "Run Java Application" from the same menu, delete the "parameters" line and replace it with:

-cp .;"C:\Program Files\Java\javafx-sdk-15\lib\javafx.base.jar";"C:\Program Files\Java\javafx-sdk-15\lib\javafx.controls.jar";"C:\Program Files\Java\javafx-sdk-15\lib\javafx.fxml.jar";"C:\Program Files\Java\javafx-sdk-15\lib\javafx.graphics.jar";"C:\Program Files\Java\javafx-sdk-15\lib\javafx.media.jar";"C:\Program Files\Java\javafx-sdk-15\lib\javafx.swing.jar";"C:\Program Files\Java\javafx-sdk-15\lib\javafx.web.jar";"C:\Program Files\Java\javafx-sdk-15\lib\javafx-swt.jar" --module-path "C:\Program Files\Java\javafx-sdk-15\lib" --add-modules=javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.swing,javafx.web $BaseName

Hit "Ok", close Textpad, then re-open Textpad.

Did it work?

If it worked, this Java program should compile and run, showing a black circle on a white background.