Tomcat之the jre_home environment variable is not defined correctly this environment variable is need
参考https://blog.csdn.net/qq_30507287/article/details/53981851
今天在服务器的tomcat上部署.war文件,双击startup闪退,然后在tomcat/bin目录下,shift+右键,打开命令行窗口,然后把startup.bat拖进命令行窗口,回车,出现“jre_home environment variable is not defined correctly this environment variable is need”问题
在操作系统上明明已经安装了JDK1.8并设置好了JAVA_HOME和JRE_HOME,可偏偏Tomcat在启动过程中找不到并且在启动startup.bat时闪退。
原因知道了,下面来看解决办法:
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:\Jdk8\jdk1.8.0_101
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,然后在浏览器中敲入http://localhost:8080验证。显示如下图所示的界面则为修改成功,tomcat登录也就成功了。
Tomcat之the jre_home environment variable is not defined correctly this environment variable is need的更多相关文章
- JRE_HOME environment variable is not defined correctly This environment variableis needed to run this program
已经安装了JDK1.7 和对应JRE 安装了tomcat8 都是解压版 并设置了JAVA_HOME.JRE_HOME 但Tomcat在启动过程中找不到 错误: the JRE_HOME environ ...
- The JRE_HOME environment variable is not defined correctly This environment
昨天启动tomcat还好好的,今天不知道抽什么风,cmd中报错: The JRE_HOME environment variable is not defined correctly This env ...
- 【基础笔记】tomcat安装后运行出现出现问题(the JRE_HOME environment variable is not defined correctly This environment variabl)
之前装好tomcat后正常运行 后来重装系统后,又一次配置环境时却报错. 在网上查找了两篇文章. https://blog.csdn.net/haleyliu123/article/details/ ...
- tomcat闪退无法启动 the catalina_home environment variable is not defined correctly this environment variable is needed to run this program
未成功配置CATALINA_HOME 1.计算机>属性>环境变量, 新建环境变量.变量名为CATALINA_HOME ,变量值tomcat的解压目录,注意后面不用多加“\”或者“;” 2. ...
- [Tomcat]The JRE_HOME environment variable is not defined correctly
在tomcat的bin目录下,双击startup.bat,闪一下,就没了,后来仔细看了一下黑屏闪的内容如下: the JRE_HOME environment variable is not defi ...
- 【TOMCAT启动异常】The BASEDIR environment variable is not defined correctly
<span style="font-size:18px;">The BASEDIR environment variable is not defined correc ...
- tomcat 环境变量配置 解决 The CATALINA_HOME environment variable is not defined correctly
文章目录 问题描述 解决方案 问题描述 已经配置好了JAVA_HOME,CLASSPATH,Path等系列环境变量,且正确配置了CATALINA_HOME值为D:\apache-tomcat-7.0. ...
- TOMCAT-报错The BASEDIR environment variable is not defined correctly
<span style="font-size:18px;">The BASEDIR environment variable is not defined correc ...
- maven错误The JAVA_HOME environment variable is not defined correctly
晚上,当我准备将好的spring boot通过mvn clean package 打包成jar文件上传到linux服务器时,却在打包过程中出现了错误: C:\>mvn -version The ...
随机推荐
- C++ "#"的作用和使用方法
本系列文章由 @yhl_leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/48879093 1 #和##的作用和使用 ...
- XShell连接不了虚拟机
本机安装好虚拟机和centeros; 使用xshell连接: linux Could not connect to '127.0.0.1' (port 22): Connection failed. ...
- Cocos2d-JS 项目接入 触控广告平台(基于anysdk2.0.2)
本文以Cocos2d-JS项目作为示例,讲解如何集成AnySDK-JS. 一.如何创建项目我就省略了,直接进入主题. 1.1 首先,我需要下载anysdk框架包,下载地址:http://www.any ...
- Qt笔记之使用设计器自定义窗口标题栏
1.在窗口显示之前,设置WindowFlags为FramelessWindowHint,以产生一个没有边界的窗口 例如 Widget::Widget(QWidget *parent) : QWidge ...
- js复杂数据格式提交
有的时候额后台需要一个对象Map值,如{name: '姓名',attributeMap:{skill: '名称;checkbox;true;&篮球:1,羽毛球:2',name:'lsg' }} ...
- linux shell执行远程计算机上的命令或者脚本(ssh)
大数据平台下经常建立设计多个节点的集群需要统一部署,这就设计到守护进程或者部署脚本在不同节点执行,如果能在master机器上,统一执行脚本,一次性启动整个集群的服务,感觉很nice.因为,分享如下内容 ...
- ORACLE 表空间扩展
最近公司在对即将上线的系统做数据迁移和压力测试,于是乎需要和 Oracle 经常的打交道.今天正好碰到了表空间的问题,记录下来以后备用.也是最近才学习到的,原来 Oracle 表空间也是有大小限制的, ...
- Android View中滚动相关
方法 scrollTo: (内容的左上角)达到某个地点 scrollBy: 根据当前位置,再移动多少 属性: mScrollX, 以下是文档解释 The offset, in pixels ...
- BigDecimal 实际测试结果
package com.zzzy; import java.math.BigDecimal; public class Test { public static void main(String[] ...
- [WC 2006] 水管局长
[题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=2594 [算法] 首先离线 , 将删边操作转化为倒序加边 假设我们已经维护出了一棵最小 ...