[JAVA] Beginners create Spring Tools Suite environment with VS Code


For studying because I'm likely to make friends with WEB API using Spring Boot in business Create Spring tool suite 4 development environment in windows10 environment. Let's make a sample site for the time being.

type name version
IDE Visual Studio Code 1.14.1
Plugin Spring Boot Extension Pack 0.0.8
Plugin Java Extension Pack 0.8.1
Java JDK
project management apache-maven 3.6.3

So, we will build the current latest (2019/12/24) "Spring Tools Suite 4" environment. The officially supported IDEs are "Eclipse", "VSCode", and "Atom", and this time we will build with VSCode.

Development environment construction


Install JDK / MAVEN / VS Code. SpringToolsSuite (STS) seems to have to be JDK 1.8 or higher, so Java 8 is installed. For MAVEN and JDK, you will need the installation path later, so I personally recommend dropping the compressed file and extracting it in an easy-to-understand place.


This time it is arranged like this

├── JDK
|   └── jdk-
└── maven
    └── apache-maven-3.6.3

Environment variable settings

Pass the path to the folder where you extracted JDK and MAVEN. In Control Panel ⇒ System ⇒ Advanced System Settings ⇒ Environment Variable Settings

  1. Add the "JAVA_HOME" and "MAVEN_HOME" items to the system environment variables (the path of the folder you unzipped earlier).
  2. Add "% JAVA_HOME% \ bin" and "% MAVEN_HOME% \ bin" to the "Path" item of the system environment variable.

Installation of plugins

Install the following on the VS Code add-on search screen. Spring Boot Extension Pack Java Extension Pack

Environment variables in VS Code

The VS Code plugins start to get angry, "Where is Java?", So I'll tell you the path you installed there as well. File ⇒ Basic settings ⇒ Settings ⇒ Add the following description to the setting file opened with the icon (Open Settings (JSON)) on the upper right.

  "java.home": "D:\\openjdk\\jdk-",
  "maven.executable.path": "D:\\apache-maven-3.6.3\\bin\\mvn", //I want to know where the maven executable is also
  "maven.terminal.useJavaHome": true //Instruct maven to look at the Java path

* If you are in a proxy environment

The installation has been completed so far, but if you are using a proxy in-house, you may get the necessary libraries when creating a project and an error may occur. In that case, perform the following procedure. ** Addition to setting.json **

  "http.proxy": "{Proxy server URL}:{port number}",
  //If it's a proxy environment, I'll specify where VS Code will download the library.

** Creating settings.xml ** Create a "settings.xml" file in "C: /Users/{username}/.m2" to allow maven to use the proxy.


<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
      <id>{A string that can be a unique ID}</id>
      <host>{Proxy server URL}</host>

How to make a project

  1. Open the folder where you want to create a project in VS Code
  2. Open the command with "Shift + Ctrl + p" and "Spring Initializr: Generate a Maven Project"
  3. "Java" ⇒ "" ⇒ "" ⇒ " (2.2.2 this time)" ⇒ "dependency selection (s)"
  4. Select a project creation folder spring_maven_start3.gif

Select the following three dependencies

  1. Spring Boot Dev Tools (Hot Reload function)
  2. Spring Web (template for creating WEB services with Spring)
  3. Thymeleaf (HTML template engine) コメント 2019-12-26 144045.png

Try to run

Open your project in VS Code (or include it in your workspace)

When you open VS Code again in the created project folder, You can see that it recognizes the projects created by Java, Maven, and Spring Boot.

コメント 2019-12-26 112612.png

Add sample page

Add the file to the path below.

\src\main\resources\templates\hogehoge.html(HTML to display)
\src\main\java\com\hogehoge\test_project\controller\HogehogeController.java(Routing controller)


package com.hogehoge.test_project.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

public class HogehogeController {

    @RequestMapping("/hogehoge") //Specify the URL here.
    public String hogehoge() {
        return "hogehoge"; //HTML with the same name as the character returned here is called.


<!DOCTYPE html>

    <meta charset="utf-8">



Can be executed with "SPRING-BOOT DASH BOARD" at the bottom left コメント 2019-12-26 145633.png

Recommended Posts

Beginners create Spring Tools Suite environment with VS Code
Create Spring Boot environment with Windows + VS Code
Java Spring environment in vs Code
Spring Boot programming with VS Code
Create Spring Boot-gradle-mysql development environment with Docker
Try using Spring Boot with VS Code
Introduction to Java development environment & Spring Boot application created with VS Code
Create a Spring Boot development environment with docker
Build a Java development environment with VS Code
Lombok with VS Code
Build Java development environment with VS Code on Mac
Build ruby debug environment with VS Code of Windows 10
Build Java development environment with WSL2 Docker VS Code
Format Ruby with VS Code
Hello World with VS Code!
Create a VS Code Plugin.
Create microservices with Spring Boot
Java web application development environment construction with VS Code (struts2)
Build WebAPP development environment with Java + Spring with Visual Studio Code
Create a Vue3 environment with Docker!
Let's create Ubuntu environment with vmware
Environment construction with Docker for beginners
Create an app with Spring Boot 2
Create RUNTEQ's environment with Windows DockerDesktop
[Note] A story about changing Java build tools with VS Code
Create SolrCloud verification environment with Docker
Create an app with Spring Boot
Create Laravel environment with Docker (docker-compose)
Getting Started with Docker with VS Code
[Be careful about changing the version of Xdebug! ] Create a development environment with Xdebug3 + docker + VS Code
Create Spring Boot development environment on Vagrant
Create Rails 6 + MySQL environment with Docker compose
Create a simple on-demand batch with Spring Batch
Create a MySQL environment with Docker from 0-> 1
[Docker] Create Node.js + express + webpack environment with Docker
[Environment construction] Spring Tool Suite4 installation (Mac)
Create login / logout function with Spring Security according to Spring official guide [For beginners]
From creating a Spring Boot project to running an application with VS Code
Spring Boot environment construction with Docker (January 2021 version)
Create a website with Spring Boot + Gradle (jdk1.8.x)
[Memo] Create a CentOS 8 environment easily with Docker
Create a simple search app with Spring Boot
[Windows] [IntelliJ] [Java] [Tomcat] Create a Tomcat9 environment with IntelliJ
JAVA + STS (Spring Tool Suite) environment construction procedure
Using Gradle with VS Code, build Java → run
Build Spring Boot project by environment with Gradle
Create CRUD apps with Spring Boot 2 + Thymeleaf + MyBatis
Create your own Utility with Thymeleaf with Spring Boot
Create a web api server with spring boot
Try debugging a Java program with VS Code
Create Spring Cloud Config Server with security with Spring Boot 2.0
What I was addicted to when developing a Spring Boot application with VS Code
Until you build a Nuxt.js development environment with Docker and touch it with VS Code
Create a Java (Gradle) project with VS Code and develop it on a Docker container
Create a private key / public key in CentOS8.2 and connect to SSH with VS Code
The procedure I did when I prepared the environment of gradle + Java with VS Code (Windows 10)
Create a Java (Maven) project with VS Code and develop it on a Docker container