13. Appendices
13.1. Installing JDK 21
[JDK] ([Java Development Kit]) contains the [javac] compiler and the [java] virtual machine. Several free distributions are available; we use [Eclipse Temurin], from the [Adoptium] project, which can be downloaded from adoptium.net: Select version 21 (LTS), then the installer for your system ([Windows] x64, [macOS], [Linux]).
In [Windows], the [.msi] installer offers the option “Set JAVA_HOME variable” on the customization screen; this option is disabled by default—you must enable it. The [JAVA_HOME] environment variable specifies the location of [JDK]; the Maven Wrapper uses it to locate [Java]. You can also use the [winget] package manager:
For [macOS], use the installer [.pkg] from the same page, or the package manager [Homebrew] ([brew install --cask temurin@21]). For [Linux] ([Ubuntu], for example), the [openjdk-21-jdk] package from the distribution’s repositories is suitable:
Verify the installation in a new console ([PowerShell], command prompt, or terminal):
which should display a version number starting with 21 (for example, [openjdk version "21.0.10"]). A newer [JDK] (25, for example) also works; an older [JDK] (17, for example) produces the error [release version 21 not supported] during compilation.
13.2. Maven and the Maven Wrapper
There is nothing to install: the [examples] folder and the case study folder each contain the Maven Wrapper, the [mvnw] scripts ([Linux], [macOS]) and [mvnw.cmd] ([Windows]), along with the file [.mvn/wrapper/maven-wrapper.properties], which specifies the version of [Maven] to use (3.9.11). When run for the first time, the script downloads this version of [Maven] and stores it in the user’s home directory ([.m2/wrapper] folder); subsequent runs reuse it. [Maven], in turn, downloads the project libraries from the Maven Central repository and stores them in the [.m2/repository] folder. An Internet connection is therefore required during the first compilation.
The Maven Wrapper requires [Java]: it uses the [JDK] specified by the variable [JAVA_HOME], or, failing that, the command [java] found in the path ([PATH]). To verify that everything is in place, compile all the examples from the [examples] folder:
([.\mvnw compile] under [Windows]). The command ends with [BUILD SUCCESS].
If you prefer to install [Maven] yourself (maven.apache.org), the command [mvn] replaces [mvnw] in all commands in the document.
13.3. Installing Visual Studio Code
Download [Visual Studio Code] from code.visualstudio.com. Add two extensions (go to the View menu > Extensions, then search for their names):
- [Extension Pack for Java], from Microsoft: a set of extensions that provides syntax highlighting, code completion, and error reporting for [Java] code; support for [Maven] projects (Java Projects pane); the debugger, and automatic compilation of each saved file;
- [Spring Boot Extension Pack], from VMware (marketplace.visualstudio.com): property autocompletion for [application.properties], navigation between beans and URL controllers, and the Spring Boot Dashboard pane, which lists the applications [Spring Boot] in the open folder and allows you to start or stop each one with a single click.
Open the [examples] folder or the case study folder (File menu / Open Folder); the integrated terminal (Terminal menu / New Terminal) allows you to run [mvnw] commands without leaving the editor. The F5 key, in an application’s startup class (the one named [@SpringBootApplication]), runs the application under the debugger’s control.
13.4. Installing MySQL with Laragon
[Laragon] (laragon.org) installs a [MySQL] server (or [MariaDB]) ready for use, along with the [HeidiSQL] administration tool. After installation:
- the “Start All” button launches the [MySQL] server on port 3306;
- the user [root] has no password: these are the default values for the [spring.datasource.*] properties from Example 28 and the case study;
- The Database button opens [HeidiSQL], where the File menu / Run a File menu item in SQL runs the scripts [dbpersons.sql] (Example 28) and [dbrdvmedecins2.sql] (Case Study).
In [Linux] or [macOS], install [MySQL] or [MariaDB] using the system’s package manager, and run the scripts using the command-line client [mysql]. The driver [JDBC] from [MySQL] also works with [MariaDB] without any configuration: [Hibernate] only displays the [HHH000511] warning at startup, with no consequences (see Example 28).
13.5. Installing curl
[curl] is included with [Windows] 10 and 11, [macOS], and most [Linux] distributions. On [PowerShell], you must type [curl.exe], not [curl]: In older versions of [PowerShell], [curl] is an alias for another command ([Invoke-WebRequest]), which has different options.