1、分析startup.bat启动脚本:发现其调用了catalina.bat,而catalina.bat调用了setclasspath.bat

2、在setclasspath.bat的头部定义了JAVA_HOME和JRE_HOME的值,那么这里需要我们手动设置JAVA_HOME变量和JRE_HOME变量(红色代码为新添加)

注意:你所设置的变量要和自己的电脑中”环境变量“里的JAVA_HOME和JRE_HOME保持一致,我的是红色的代码。

@echo off

rem Licensed to the Apache Software Foundation (ASF) under one or more

rem contributor license agreements.  See the NOTICE file distributed with

rem this work for additional information regarding copyright ownership.

rem The ASF licenses this file to You under the Apache License, Version 2.0

rem (the "License"); you may not use this file except in compliance with

rem the License.  You may obtain a copy of the License at

rem

rem     http://www.apache.org/licenses/LICENSE-2.0

rem

rem Unless required by applicable law or agreed to in writing, software

rem distributed under the License is distributed on an "AS IS" BASIS,

rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

rem See the License for the specific language governing permissions and

rem limitations under the License.

rem ---------------------------------------------------------------------------

rem Set JAVA_HOME or JRE_HOME if not already set, ensure any provided settings

rem are valid and consistent with the selected start-up options and set up the

rem endorsed directory.

rem ---------------------------------------------------------------------------

set JAVA_HOME=D:\tomcat\apache-tomcat-7.0.65

set JRE_HOME=D:\Jdk8\jdk1.8.0_101\jre

rem Make sure prerequisite environment variables are set

rem In debug mode we need a real JDK (JAVA_HOME)

if ""%1"" == ""debug"" goto needJavaHome

rem Otherwise either JRE or JDK are fine

if not "%JRE_HOME%" == "" goto gotJreHome

if not "%JAVA_HOME%" == "" goto gotJavaHome

echo Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

echo At least one of these environment variable is needed to run this program

goto exit

:needJavaHome

rem Check if we have a usable JDK

if "%JAVA_HOME%" == "" goto noJavaHome

if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome

if not exist "%JAVA_HOME%\bin\javaw.exe" goto noJavaHome

if not exist "%JAVA_HOME%\bin\jdb.exe" goto noJavaHome

if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome

set "JRE_HOME=%JAVA_HOME%"

goto okJava

:noJavaHome

echo The JAVA_HOME environment variable is not defined correctly.

echo It is needed to run this program in debug mode.

echo NB: JAVA_HOME should point to a JDK not a JRE.

goto exit

:gotJavaHome

rem No JRE given, use JAVA_HOME as JRE_HOME

set "JRE_HOME=%JAVA_HOME%"

:gotJreHome

rem Check if we have a usable JRE

if not exist "%JRE_HOME%\bin\java.exe" goto noJreHome

if not exist "%JRE_HOME%\bin\javaw.exe" goto noJreHome

goto okJava

:noJreHome

rem Needed at least a JRE

echo The JRE_HOME environment variable is not defined correctly

echo This environment variable is needed to run this program

goto exit

:okJava

rem Don't override the endorsed dir if the user has set it previously

if not "%JAVA_ENDORSED_DIRS%" == "" goto gotEndorseddir

rem Set the default -Djava.endorsed.dirs argument

set "JAVA_ENDORSED_DIRS=%CATALINA_HOME%\endorsed"

:gotEndorseddir

rem Don't override _RUNJAVA if the user has set it previously

if not "%_RUNJAVA%" == "" goto gotRunJava

rem Set standard command for invoking Java.

rem Also note the quoting as JRE_HOME may contain spaces.

set _RUNJAVA="%JRE_HOME%\bin\java.exe"

:gotRunJava

rem Don't override _RUNJDB if the user has set it previously

rem Also note the quoting as JAVA_HOME may contain spaces.

if not "%_RUNJDB%" == "" goto gotRunJdb

set _RUNJDB="%JAVA_HOME%\bin\jdb.exe"

:gotRunJdb

goto end

:exit

exit /b 1

:end

exit /b 0

3、添加变量后保存,并关闭文件,重新启动tomcat

the jre_home environment variable is not defined correctly this environment vari相关推荐

  1. Tomcat运行出现出现问题(the JRE_HOME environment variable is not defined correctly This environment variabl)

    错误:The JAVA_HOME environment variable is not defined correctly This environment variable is needed t ...

  2. 配置Maven时报错The JAVA_HOME environment variable is not defined correctly,this environment解决方法汇总

    配置Maven时报错The JAVA_HOME environment variable is not defined correctly,this environment variable is n ...

  3. Tomcat之the jre_home environment variable is not defined correctly this environment variable is need

    在之前学Java的时候,我已经配置好了JAVA_HOME,但是今天启动Tomcat服务器的时候,却闪退,而且无法访问Tomcat服务器. 接下来,我来说一下我的解决方法. 我们首先编辑一下startu ...

  4. tomcat命令无法启动 the catalina_home environment variable is not defined correctly this environment variab

    配置完tomcat之后通过命令行起到不了 出现这种情况是因为配置环境有问题导致的, 具体配置点此链接查看,https://blog.csdn.net/qq_43412289/article/detai ...

  5. The JAVA_HOME environment variable is not defined correctly This environment variable is needed to r

    配置MAVEN 搞了很久没搞出来,最后删了JAVA_HOME变量,重新写,结果居然好了.无语

  6. the java home_the java_home environment variable is not defined correctly

    在启动tomcat中的startup.bat时,总是报以下错误 the java_home environment variable is not defined correctly This env ...

  7. maven错误The JAVA_HOME environment variable is not defined correctly

    晚上,当我准备将好的spring boot通过mvn clean package 打包成jar文件上传到linux服务器时,却在打包过程中出现了错误: C:\>mvn -version The ...

  8. The JAVA_HOME environment variable is not defined correctly,

    linux安装maven查看版本时提示如标题: [root@iZ2zeiyfk6wfvd1y5al5maZ middleware]# mvn -version The JAVA_HOME enviro ...

  9. tomcat配置报错解决方法 The jre_home environment variable is not defined correctly

    tomcat配置报错解决方法 The jre_home environment variable is not defined correctly 参考文章: (1)tomcat配置报错解决方法 Th ...

  10. maven 配置(安装)以及遇到的The JAVA_HOME environment variable is not defined correctly.

    1.下载安装maven 你可以去http://maven.apache.org/download.html   下载最新的maven,目前最新版本是maven-3.2.1 选择链接下载压缩包并解压,我 ...

最新文章

  1. org/springframework/core/ErrorCoded
  2. Facebook推出人脸识别新功能,防止用户肖像遭滥用
  3. lintcode: 跳跃游戏 II
  4. 利用微服务构建现代应用(一)
  5. 使用webpack引入sass全局变量
  6. PHP的威胁函数与PHP代码审计
  7. vsftpd配置不同用户不同目录
  8. java制作qq机器人(脚本实现和调用QQ官方api实现)
  9. html代码实现简单的简历模板
  10. 科技感十足炫酷引导页网站源码
  11. 电子签章安全用印方案:系统“三员分立”+印章“三权分立”
  12. 从张家界火车站如何去张家界玻璃桥游玩,最详细的张家界攻略
  13. 腾讯云国外服务器2核4G服务器新用户全攻略
  14. 用Java 开发 WebService Axis简单实例
  15. 浅谈面试与简历——总结于尚硅谷视频《程序员面试指南》
  16. matlab 天线设计 泰勒加权_泰勒加权功分器
  17. html消除绝对定位的影响,CSS 绝对定位 ,浮动,清除浮动
  18. 计算机网络方面国际三大顶尖会议 - MOBICOM - SIGCOMM - INFOCOM
  19. 关联规则--Apriori算法
  20. CRT串口工具使用方法2022.08.11

热门文章

  1. es中索引对象包含数组子节点时, 查询和聚合的统计需要注意的问题。
  2. layui扩展组件(组合输入框inputTags)
  3. 制图小课堂:美国机场可视化黑白围棋风格专题
  4. Duplicate entry '127' for key 'PRIMARY'
  5. 中国步进电机市场现状研究分析与发展前景预测报告(2022)
  6. python 数据shape的理解
  7. yaml UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xba in position 15: illegal multibyte sequen
  8. 深度解析“中国制造2025”VS德国“工业4.0”,一场没有硝烟战争
  9. 日期类超详解(c++入门)
  10. Vue学习---插槽篇