How to install Java, Spring Tool Suite (STS), and configure JDK

Introduction

Installing Java is a prerequisite for running Java applications. Spring Tool Suit (STS) is an integrated development environment (IDE) specifically designed to develop Spring Framework applications. Configuring the Java Development Kit (JDK) in STS is essential for linking the IDE with the Java runtime. Let’s see how we can install all three of these.

Install Java

We can install Java using the command line or through the desktop installation. Below are the instructions for the desktop installation.

  • Step 1: First, we will download the Java installer for the latest version of Java from Oracle Java downloads according to our OS. We are installing the “ARM64 DMG Installer” for MacOS.

Downloading Java installer
Downloading Java installer
  • Step 2: The dmg file will contain the JDK package. Clicking it will open the installation wizard as shown below:

Installation wizard
Installation wizard
  • Step 3: Click the “Continue” button. Next, it will provide information regarding the required space for the Java installation.

  • Step 4: Click the “Install” button. Now, it will ask for the system login password. After entering the password, click the “Install Software” button.

It will start the installation. Once the installation is complete, we will be prompted with the “Install Succeeded” on the wizard.

Install Spring Tool Suit (STS)

Spring Tool Suit (STS) can be installed with Visual Studio Code or Eclipse IDE. First, navigate to the official STS download page to download the STS installer for the desired OS. Let’s look at the installation steps for Mac OS and Eclipse.

  • Step 1: Download the “MAC ARM_64” version or the latest “MAC X86_64” version available.

Downloading Spring Tool Suit
Downloading Spring Tool Suit

Note: Download the MAC X86_64 installer for Intel-based Mac processors.

  • Step 2: When we click the dmg file, it will show the STS installer. Select the “SpringToolSuit4” option.

Installing Spring Tool Suit
Installing Spring Tool Suit
  • Step 3: Select the “Open” option from the prompt asking permission to open it. It will show the STS splash screen. Next, the launcher will ask to select the directory for setting up the STS workspace. Select the directory and click the “Launch” button.

Setting up the Spring Tool Suit
Setting up the Spring Tool Suit

Note: The OS might prompt, “SpringToolSuite4 would like to access files in your x folder.” Click the “Allow” button to grant access.

Now, our STS installation is completed.

Configuring JDK in STS

Configuring the required JDK in STS is simple. In STS, go to “Sprint tool suit 4” in the menu bar.

Configure JDK in STS
Configure JDK in STS

Then go to “Preferences ==> Installed JREs” and select the required JRE/JDK.

Selecting JRE/JDK
Selecting JRE/JDK

Select the “Apply and Close” option. The selected JDK will now be the default JDK for all projects.

This completes our installation process for setting up a robust environment for Java and Spring Framework applications.

Copyright ©2024 Educative, Inc. All rights reserved