Java

Setup Spring Environment in Windows

In this article, we will learn to set up an environment to create and run spring application in Windows.

To create a Spring application, we need to set up and install the following tools/software:

Let’s start one by one to install:

Install Java

It is a programming language that we will use to create a spring application. It is used to write the business logic of the application. It is one of the popular and best programming languages to write enterprise applications. To get more about Java refer to our java article.

To download this, you can visit its official site and download the latest version. We recommend that you download either Java 11 or Java 17 LTS version.

If you have not installed it then use our step-by-step article to install java in Windows.

After installing it, set its classpath to make it available throughout the windows. For this, you can follow our article – how to set path in java.

Download Eclipse IDE

Eclipse is an IDE that we will use to write/develop a spring application. It is a platform that provides all the development tools in the same place. So, the development task gets easier and more rapid.

We will use Eclipse throughout this tutorial series to develop the spring applications. If you wish to install other IDE such as STS (Spring Tools Suite, an official IDE of Spring) or IntelliJ IDEA. You can use that too.

To download the Eclipse, visit the official site https://www.eclipse.org/downloads/ and install it.

Note: While installing the Eclipse make sure you have installed Java and set up its classpath because during eclipse installation it requires these settings to integrate the JRE and JDK.

Download Server

The server is a container that provides the environment to run our application spring application. We will use the tomcat server. You can get it from its official site. The official site looks like this:

Click on the installer and install by following the instructions:

By default, the apache server is installed on the 8080 port. Although you can change it but here, we will leave it to the default value.

After successful installation, you can check it by entering the localhost:8080 to the browser and you will see the screen like this:

For more information, you can refer to our detailed article on how to install tomcat in windows.

Connecting Apache Server to Eclipse IDE

After installing Eclipse and Apache server successfully, let’s connect them all to make the proper environment for Spring development.

First, open the eclipse IDE and select the server tab at bottom of the IDE, like this:

Currently, no server is added. So, click on the link to add a new server. Clicking on the links open a window to ask the server, like this:

Select the server and its version that you installed (apache9 in our case) and click next. It will open a window again to ask for the location of your server, like this:

Provide the location and click finish. Then, it will show the added server into the server tab, like this:

It means you have successfully added/connected the server to the Eclipse IDE.

After doing all these, let’s move to the next step and download Spring dependency JARs.

Download Spring JARs

Spring JARs or Spring libraries are the Java files that contain all the Java code/tools to create Spring applications. These files contain classes, methods, and useful packages such as org.springframework—the base package of the Spring.

You can download these JARs from the official site of the Spring by using this URL: https://repo.spring.io/ui/native/libs-release/org/springframework/spring/ . Here, you can select the spring version wise and download it to your local machine and extract them. We will learn how to add these to the project in the next articles while creating project. But for now, just keep them in your local system.

If you don’t want to download these files manually then use the maven tool while creating the spring application. The Maven is a dependency management tool that downloads all your JARs automatically to your spring project. We will learn how to create to a spring project using Maven in our next articles.

After completing all these required steps. Now, we can easily create Spring applications. In our next topic, we will create and run a spring application using Eclipse.

About the author

Irfan Khan

I’m a software programmer having more than 5 years of development experience in Java and related technology. I love to write technical content as well and love to share the technical knowledge to make it available for all.