Javaw.exe error when starting Spring Boot (STS)

Background

I first encountered SpringBoot when I was researching a company and wondered what it was. Anyway good! So, I'm not good at java at all, but should I touch it? I thought, I referred to various URLs and started construction.

I will post for the first time. If you have any deficiencies, please contact us.

result

A level that even Hello World cannot do. I did my best and it worked, so I thought I would share it for those who are stumbling at the entrance with similar thoughts.

environment

Windows 10 64bit

STS installation

For SpringBoot, it seems that STS, which has eclipse and the execution environment attached, is convenient.

――I downloaded STS4 from the following URL.

STS Download URL

The file name was as follows. spring-tool-suite-4-4.1.2.RELEASE-e4.10.0-win32.win32.x86_64.zip

--I created a folder called sts directly under the C: drive. --The zip file you downloaded earlier is stored in the sts folder. --Unzipped the zip file in the sts folder.

If you execute SpringToolSuite4.exe in this state, the following error will be output. キャプチャ.PNG

When I googled with this error, it says that java is not installed. If you take a closer look, C:\sts\sts-4.1.2.RELEASE\jre\bin\javaw.exe Is output. If you place java in this location, you can start it ...? I thought.

Java installation

I had vague knowledge that the JRE was an executable version in the java runtime, so I'll try to install it. However, if you simply install java, it will conflict with other environments and will be upgraded every time! Version upgrade! I had a noisy image, so I decided to unzip it and place it in the path mentioned above. Since STS is 64bit version, java is also 64bit version. I couldn't find the JRE for some reason, so download the JDK from the URL below. (I'm sorry if it's bad ...)

JDK Download URL

The downloaded file name is as follows. jdk-11.0.2_windows-x64_bin.zip

Follow the steps below to place this file in the path referenced by STS above.

--Place the downloaded zip file in C: \ sts \ sts-4.1.2.RELEASE. --Unzip the placed zip file. --When you unzip it, a folder called "jdk-11.0.2" will be created.
Rename the "jdk-11.0.2" folder to "jre".

You should now be able to launch SpringToolSuite4!

Create your first project

--Click File> New> Spring Starter Project --Next as it is --Check the following and go to the next - Template Engines - Thymeleaf - Web - Web

A progress bar will appear at the bottom right of the screen, so wait for a while.

Launch the Demo application

Launch the demo application you created.

--Right click on the project> Run As> Spring Boot App

I get the following error ...

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
	String cannot be resolved to a type
  
	at com.example.demo.DemoApplication.main(DemoApplication.java:9)

Missing String?

Add JRE

Launch the Demo application again

Right click on the project> Run As> Spring Boot App

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.3.RELEASE)
~(abridgement)~
DemoApplication in 2.981 seconds (JVM running for 4.501)

I was able to start!

Finally

Initially, I was trying with STS 3.9.7, and when I came across this event, I thought about posting it on Qiita and tried to reproduce it, but it went well with STS 4 series. So, when I tried it again, I reproduced it, and when I tried it in the same way as STS 3.9.7, it worked. It would be easy if java was installed, but I wanted to do something by force, so it became like this.

At the time of STS 3.9.7, Maven sometimes got in the way and it didn't work, but I was able to solve it by the following procedure according to the contents of this page.

――Close STS once --Delete the `` `C: \ Users \ \ .m2``` folder --Start STS --Wait for a while in the Building workspace --Right click on the project> Maven> Update Project> OK --Wait for a while

Recommended Posts

Javaw.exe error when starting Spring Boot (STS)
Spring Boot starting with copy
Spring Boot starting with Docker
Memorandum of understanding when Spring Boot 1.5.10 → Spring Boot 2.0.0
Spring Boot + PostgreSQL error resolution method
About error when implementing spring validation
Spring Boot starting from zero Part 2
Spring Boot starting from zero Part 1
Unknown error in line 1 of pom.xml when using Spring Boot in Eclipse
Error in implementation when implementing Spring validation
Changes when migrating from Spring Boot 1.5 to Spring Boot 2.0
Changes when migrating from Spring Boot 2.0 to Spring Boot 2.2
Spring Boot Whitelabel Error Page and JSON Response
When @Transactional of Spring Boot does not work
Challenge Spring Boot
When you want to notify an error somewhere when using graphql-spring-boot in Spring Boot
Annotation notes when writing tests for Spring Boot
Spring --Error / Error avoidance when creating API for POST
Spring Boot Form
Spring Boot Memorandum
gae + spring boot
Customize the display when an error such as 404 Not Found occurs in Spring Boot
Error when starting JUnit with deprecated version of POI
[Note] Configuration file when using Logback with Spring Boot
[Java] [Spring Boot] Specify runtime profile --Spring Boot starting with NetBeans
Customize REST API error response with Spring Boot (Part 2)
A memorandum when creating a REST service with Spring Boot
Customize REST API error response with Spring Boot (Part 1)
SPRING BOOT learning record 01
Spring Boot + Heroku Postgres
Spring boot memo writing (1)
Error when using SnapKit
First Spring Boot (DI)
SPRING BOOT learning record 02
Spring Boot2 cheat sheet
Spring Boot exception handling
Spring Boot Servlet mapping
Spring boot development-development environment-
Spring Boot learning procedure
Error when bundle install
Learning Spring Boot [Beginning]
Spring boot memo writing (2)
Spring Boot 2.2 Document Summary
[Spring Boot] DataSourceProperties $ DataSourceBeanCreationException
Error when deploying EC2
Spring Boot 2.3 Application Availability
Spring boot tutorials Topics
Download with Spring Boot
What I fixed when updating to Spring Boot 1.5.12 ・ What I was addicted to
Get error information using DefaultErrorAttributes and ErrorAttributeOptions in Spring Boot 2.3
Various switching application.properties for each environment when Spring Boot starts