Installing JavaFX on Personal Machines

At this time, we recommend installing version 12.0.2 of JavaFX. Different versions of JavaFX can be found online however, and the installation process will be the same.


Installing On Windows

  1. Go to https://gluonhq.com/products/javafx/ and download JavaFX Windows SDK, not JMODS. We recommend keeping the unzipped version of the file in your Downloads folder.
  2. Open a File Explorer window and find the javafx-sdk-12.0.2/lib folder. 
  3. Copy the path to this location.
  4. You now need to add an environment variable for JavaFX. In your terminal, using your copied path, run the command: set PATH_TO_FX="path\to\javafx-sdk-12.0.2/lib".
  5. You should now be able to compile and run programs using JavaFX.

Installing On MacOS

  1. Go to https://gluonhq.com/products/javafx/ and download JavaFX Mac OS X SDK. 
  2. Navigate to Downloads and unzip the file by double clicking on it.
  3. Find the absolute path to your Downloads folder. Open a new terminal window and run the command: cd Downloads; pwd . Copy the resulting path.

  4. In your terminal, run the command: export PATH_TO_FX="[path-to-downloads]/javafx-sdk-12.0.1/lib", pasting in the absolute path to your Downloads folder.

    1. (Note: you will need to do this final step each time you open a new terminal window, as the PATH_TO_FIX variable does not carry over between terminal windows.)

Installing On Ubuntu (18.04 or newer)

  1.  Open a command line

  2.  Type "apt install openjfx" to get the package

  3.  It is installed to /usr/share/openjfx/lib
  4. In your terminal, run the command: export PATH_TO_FX="/usr/share/openjfx/lib", pasting in the absolute path to your Downloads folder.

    1. (Note: you will need to do this final step each time you open a new terminal window, as the PATH_TO_FIX variable does not carry over between terminal windows.)

Running Programs

You should now be able to compile and run programs using JavaFX, using the syntax:

           javac --module-path $PATH_TO_FX program_name.java

           java --module-path $PATH_TO_FX program_name