The Practice and Philosophy of Object-Oriented Programming in Java

How to Add Resources to an IntelliJ Project

Your application can load resources such as audio and image files at runtime. For this you will need to create a resources folder in the project's root directory. Your resources can be stored directly in this folder or organized within subfolders.

The process is illustrated below for the BirdSong application (Listing 9.6d). You can see in the following image how audio and image files have been organized within a resources folder.

Next, you need to mark the folder as resources root. To do this, open the File > Project Structure dialog, select the Modules tab, and click on the resources folder.

The result will be as shown below.

Your application can now access resources from the resources folder.

Return to Companion Site home page