The Practice and Philosophy of Object-Oriented Programming in Java
Return to Companion Site
How to Set Up IntelliJ IDEA for Java and JavaFX Development
Step 1: SOFTWARE TO DOWNLOAD
You will need the following packages:
javafx-sdk(with version number appended). Unzip the folder and move it to a permanent location on your hard drive.
When you install the JDK, you will be prompted to create the home directory in a default
location on your hard drive or to select another location — either way, make note of the
location so that you can refer to it later. The following image shows the Windows installer
saving the JDK to
Using an Older Version of the JDK
Java 8, released in 2014, includes all of the language and library features used in this book, so it is not technically necessary to have the most recent release. However, Oracle recommends uninstalling any versions prior to Java 11 for security reasons, noting also that the latest version will offer the newest feature updates, bug fixes, and performance improvements. If you do choose to use Java 8, you do not need to download JavaFX and you can skip the remaining steps below since JavaFX was part of the JDK 8. With the advent of Java 11 in 2018, however, JavaFX was removed from the JDK so that it could evolve at its own pace as an independent open-source project guided by Oracle and others in the OpenJFX community.
Step 2: Configuring IntelliJ IDEA for Java Development
After installing IntelliJ IDEA, you will need to configure it for Java development by specifying the location of the JDK home directory. To do this, start the IDE, click on the configure gear at the bottom of the welcome screen, and select Structure for New Projects:
The following dialog will appear:
+ icon to add a new JDK:
Enter or select the JDK home directory. In the example shown below, there are two versions available (13 and 14.0.1) and the latter is selected:
After selecting the JDK home directory, a list of class paths will automatically appear in
OK button. Your IDE is now configured with the JDK. However, for projects
using JavaFX classes it will be necessary to perform one additional step.
Step 3: Adding JavaFX Libraries to your IntelliJ Project
If you create a new JavaFX application or open an existing one, you will notice compile-time
errors in the editor: names of classes in the JavaFX API are not recognized. To fix this, you
need to add the JavaFX libraries to the project. First, click on the
File menu and
Structure. In the dialog that appears, select the
Libraries tab and click the
+ icon to add a new Java library:
javafx-sdk folder and select the
Click the OK button to complete the process.
For troubleshooting information, consult the JetBrains help page.