The Practice and Philosophy of Object-Oriented Programming in Java

How to Set Up Java and IntelliJ IDEA

Step 1: Download and install software

  1. You will need the Java Development Kit to write and run Java applications. There are two major implementations: Oracle JDK and OpenJDK. The differ in terms of licensing and release schedules, but for personal use it really does not matter which one you choose. Just pick one and download/install the latest version (or see the note below about using an older version).
  2. Download and install IntelliJ IDEA (Community Edition). See the installation guide for OS-specific instructions if needed.

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 C:\Program Files\Java\jdk-14.0.1\.

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.

Step 2: Configure IntelliJ 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:

Click the + 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 the classpath tab:

Click the OK button. Your IDE is now configured with the JDK.

Return to Companion Site home page