Appendix A. Code Examples and IntelliJ IDEA

This appendix will help you get up and running with the code examples found throughout the book. Some of the steps here were mentioned in Chapter 2, but we want to go through them a little slower here with specific details on how to use the book examples inside the free Community Edition of IntelliJ IDEA from JetBrains. As noted in “Installing IntelliJ IDEA and Creating a Project”, you can get IntelliJ from the jetbrains.com site. And they have an excellent installation guide if you need more help setting things up.

Once you have IDEA installed, you’ll want to make sure you have a recent version of the JDK selected. (If you still need to install Java itself, “Installing the JDK” has details for each of the major platforms.) The File → Project Structure dialog shown in Figure A-1 allows you to select from any JDKs you have installed. For the purposes of this book, you will need at least Java 19. You will also want to set the “Language level” option to the Preview version for your chosen JDK.

ljv6 0A01
Figure A-1. Enabling Java’s preview features in IntelliJ IDEA

In this example, we use Corretto 20 and select the 20 (Preview) language level. If you want more information on enabling Java’s preview features in IntelliJ IDEA, check out their preview feature tutorial online.

We also want to reiterate that IntelliJ IDEA is not the only Java-friendly ...

Get Learning Java, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.