How to Install Spring Tool Suite 4 (STS) on Windows 11

Spring Tool Suite 4 (STS) is a powerful IDE designed specifically for Spring developers. It makes it easy to build Spring applications by providing features like code suggestions, built-in templates, and integration with Spring Boot. In this guide, we’ll explain how to install STS on Windows 11 and create your first Spring Boot project with simple REST API.

YouTube Video

We recommend watching the YouTube video below to learn how to install the Spring Tool Suite 4 (STS) IDE step-by-step on Windows 11 and create a simple Spring Boot project with the REST API.

Why Use Spring Tool Suite 4?

  • Spring Boot Integration: STS simplifies the process of creating Spring Boot projects.
  • Developer-Friendly: It offers code navigation, debugging tools, and built-in support for Spring Framework.
  • Free and Open Source: STS is free to use and maintained by the creators of Spring.

Step 1: Download Spring Tool Suite 4 (STS)

  1. Open your browser and visit the official Spring Tool Suite download page.
  2. Scroll down to find the Spring Tools 4 for Eclipse section.
  3. Select the version for Windows x64.
  4. Click the Download button to start downloading the ZIP file.
How to Install Spring Tool Suite 4 (STS) on Windows 11

Step 2: Install Spring Tool Suite 4

  1. After the ZIP file is downloaded, locate it in your Downloads folder.
  2. Extract the ZIP file by right-clicking on it and selecting Extract All.
  3. Choose a folder to extract the files (e.g., C:\STS4).
  4. Navigate to the extracted folder and double-click the SpringToolSuite4.exe file to launch STS.

Step 3: Set Up Spring Tool Suite Workspace

  1. When STS opens for the first time, it will prompt you to select a workspace.
  2. The workspace is where all your Spring projects will be stored.
  3. Use the default path or specify a custom folder and click Launch.

Step 4: Install Java Development Kit (JDK)

  1. Ensure you install the latest Java Development Kit (JDK 23) on your system.
  2. Verify your JDK setup:
    • Open the Command Prompt.
    • Run java -version. You should see the JDK version.

Step 5: Create Your First Spring Boot Project

Step 5.1: Start a New Spring Boot Project

  1. In STS, click on File > New > Spring Starter Project.
  2. Fill in the details:
    • Project Name: Enter HelloSpringBoot.
    • Type: Maven (default).
    • Packaging: Jar.
    • Java Version: Ensure it matches your JDK version (e.g., 17 or 23).
  3. Click Next.

Step 5.2: Add Dependencies

  1. In the next window, select the dependencies you need. For a simple project, choose:
    • Spring Web: For building REST APIs.
  2. Click Finish to create the project.

Step 5.3: Explore the Project Structure

  1. STS will generate a project structure with key folders like:
    • src/main/java: Contains your Java code.
    • src/main/resources: Contains configuration files like application.properties.
  2. Open the HelloSpringBootApplication.java file in the src/main/java folder.

Step 5.4: Write Your First Spring Boot Application

  1. Update the HelloSpringBootApplication.java file as follows:

    package com.example.hellospringboot;
    
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.web.bind.annotation.GetMapping;
    import org.springframework.web.bind.annotation.RestController;
    
    @SpringBootApplication
    @RestController
    public class HelloSpringBootApplication {
    
        public static void main(String[] args) {
            SpringApplication.run(HelloSpringBootApplication.class, args);
        }
    
        @GetMapping("/")
        public String hello() {
            return "Welcome to Spring Boot!";
        }
    }
    
  2. Save the file by pressing Ctrl + S.

Step 5.5: Run Your Spring Boot Application

  1. Right-click on the project in the Package Explorer.
  2. Select Run As > Spring Boot App.
  3. STS will start your application, and you’ll see logs in the Console window.

Step 5.6: Test Your Application

  1. Open your browser and navigate to http://localhost:8080.
  2. You should see the message:
    Welcome to Spring Boot!

Troubleshooting Tips

  • Java Not Found: Ensure the JDK path is correctly set in the JAVA_HOME environment variable.
  • STS Not Launching: Make sure you’ve downloaded the correct version for Windows x64 and extracted the files properly.
  • Port Already in Use: Change the default port by adding server.port=8081 to the application.properties file.

Conclusion

Congratulations! You’ve successfully installed Spring Tool Suite 4 on Windows 11 and created your first Spring Boot project. With STS, developing Spring applications becomes much easier and more efficient. Keep exploring its features, and enjoy building powerful Java applications. Happy coding!

Comments