TomCat startup cannot find the configured environment variable The JRE_HOME environment variable is not defined correctly

complete error message

The JRE_HOME environment variable is not defined correctly
This environment variable is needed to run this program

First of all, you need to open your environment variable to check whether you have configured JRE_HOME,
win + R => run = "sysdm.cpl
insert image description here
to find the environment variable, open it to check whether it has been configured, if there is no configuration, re-open tomcat after configuration . If JRE_HOME is configured, it still prompts that it cannot refer to the following solutions.
insert image description here

Solution:
Found the reason:
Another batch process is actually called in startup.bat, which is the file setclasspath.bat. Open this file in text form, and what is written in it is to find the JAVA_HOME and JRE_HOME paths you configured. Since the computer If he is so stupid that he can't find it, then we won't let him find it, and we will just give it to him and it's over.

Reference https://www.cnblogs.com/1693977889zz/archive/2018/04/06/8726920.html

Open your tomcat directory, enter the bin file, and find setclasspath.batthis file. Note that there is a file with the same name with a suffix of sh. Don’t open it by mistake. I use notepad++ to open it here. Add the path of JRE_HOME and JAVA_HOME as shown in the figure below

insert image description here
It is convenient for everyone to paste, pay attention to modify the path:

set JAVA_HOME=D:\env\java\jdk1.8.0_221
set JRE_HOME=D:\env\java\jre

Then start your tomcat's stattup.bat file, and tomcat can run smoothly.
insert image description here

Article reference: https://www.cnblogs.com/1693977889zz/archive/2018/04/06/8726920.html

Guess you like

Origin blog.csdn.net/chang100111/article/details/120859522
Recommended