windows系统:

部署了一个Tomcat8.5.15,bin目录下startup.bat执行,结果提示Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At least one of these environment variable is needed to run this program。

解决方式:

在setclasspath.bat的开头声明环境变量。如图所示:

先看Tomcat的startup.bat,它调用了catalina.bat,而catalina.bat则调用了setclasspath.bat。只要在setclasspath.bat的开头声明环境变量,如我的就是:

rem ---------------------------------------------------------------------------
rem Set CLASSPATH and Java options
rem
rem $Id: setclasspath.bat 505241 2007-02-09 10:22:58Z jfclere $
rem ---------------------------------------------------------------------------

set JAVA_HOME=E:\Java\jdk1.8.0_151
set JRE_HOME=E:\Java\jre8

rem Make sure prerequisite environment variables are set
if not "%JAVA_HOME%" == "" goto gotJdkHome
if not "%JRE_HOME%" == "" goto gotJreHome
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
......

这样在每次运行startup.bat时就注册了JAVA_HOME,JRE_HOME。控制台窗口关闭后,这两个变量也将消失,不会再占用内存

linux系统:

在tomcat的bin目录下,编辑catalina.sh文件,加入

export JAVA_HOME=/usr/local/java/jdk1.8.0_151

export JRE_HOME=/usr/local/java/jdk1.8.0_151/jre

这两行,重新启动就正常!

本章完,个人经验记录,仅供参考!

白驹过隙,当看到比你优秀的人比你还努力的时候,你也会越来越优秀,相信越努力越幸运!

tomcat启动报错:Neither the JAVA_HOME nor the JRE_HOME environment variable is defined的更多相关文章

  1. tomcat 启动 报错Neither the JAVA_HOME nor the JRE_HOME environment variable is definedtemp

    catalina.sh 加入环境 export JAVA_HOME=/usr/local/jdk1.7.0_79 export CATALINA_HOME=/home/sa/webserver/tom ...

  2. Tomcat9+JDK 13报错Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At least one of these environment variable is needed to run this program

    Tomcat使用的是https://tomcat.apache.org/download-90.cgi Tomcat9 之前安装的JDK 13,有JAVA_HOME环境变量地址(C:\Program ...

  3. 普通用户操作tomcat项目时报:Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At least one of these environment variable is needed to run this program

    在使用普通用户更新tomcat项目适合出现这个信息,Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At ...

  4. tomcat启动报错:Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At least one of these environment variable

    linux 下 启动tomcat 报: Neither the JAVA_HOME nor the JRE_HOME environment variable is definedAt least o ...

  5. 启动tomcat 报错:Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

    [root@localhost META-INF]# systemctl start tomcat Job for tomcat.service failed because the control ...

  6. Java项目启动时候报Neither the JAVA_HOME nor the JRE_HOME environment variable is defined 解决办法

    今天在发布Java项目的时候又遇到    Neither the JAVA_HOME nor the JRE_HOME environment variable is defined  At leas ...

  7. CentOS Tomcat启动 Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

    链接:http://blog.csdn.net/shangdiyisi/article/details/9477521 [bravoinfo@bravoinfo-hk-01 apache-tomcat ...

  8. Jenkins启动Tomcat时提示Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

      Jenkins构建提示: [SSH] executing...Neither the JAVA_HOME nor the JRE_HOME environment variable is defi ...

  9. linux安装tomcat Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

    这两天我们的开发机重启了好几次,发现每次重启后我的tomcat总是没有启动.检查java路径,配置正确,后来拿普通账号启动tomcat时报如下的错: Neither the JAVA_HOME nor ...

随机推荐

  1. Java——常用类(StringBuffer)

    [StringBuffer]   <1>java.lang.StringBuffer代表可变的字符序列. <2>StringBuffer和String类似,但是StringBu ...

  2. 所有input输入完成后,改变按钮颜色

    $(function(){ $('input').on('input propertychange',function(){ if(($.trim($('.add1').val())!==" ...

  3. 贪心整理&一本通1431:钓鱼题解

    题目传送 (其实有一个更正经的题解) 看了许久,发现这题貌似就是一个动态规划啊,但毕竟是贪心题库里的题,还是想想用贪心解吧. 经过(借鉴大佬思路)十分复杂的思考后,终于理解出了这题的贪心思路.该题的难 ...

  4. [CSP-S模拟测试]:题(DP+数学)

    题目描述 出个题就好了.这就是出题人没有写题目背景的原因.你在平面直角坐标系上.你一开始位于$(0,0)$.每次可以在上/下/左/右四个方向中选一个走一步.即:从$(x,y)$走到$(x,y+1),( ...

  5. zk的KeeperErrorCode = ConnectionLoss错误

    额,这东西都快把人搞崩溃了,各种排查各种正常. 最后竟然是因为我在客户端未连接上zkserver的时候就进行了create操作造成的错误. 噗, Exception in thread "m ...

  6. JavaScript-Templates

    https://github.com/blueimp/JavaScript-Templates https://blueimp.github.io/JavaScript-Templates/ http ...

  7. 在php中获取 数据库的内容,返回到页面

    <?php header("content-type:text/html;charset=utf-8"); $link=mysqli_connect("localh ...

  8. 高通Android camera运行流程【转】

    本文转载自:http://blog.csdn.net/unicornkylin/article/details/13293295 1.总体架构 Android Camera 框架从整体上看是一个 cl ...

  9. RAC容灾演练

    RAC容灾演练:在节点一进行验证:步骤 操作命令关闭步骤 检测RAC集群资源状态 crsctl status resource -t 关闭监听 srvctl stop listener -n < ...

  10. 图论之点双&边双

    说人话: 边双联通: a到b的路径上无必经边 点双联通: a到b的路径上除了a,b没有必经点 tarjan求点双联通: 代码(补图) 割点: 桥: 求点双:强制dfs时不越过割点,即可求出一个块 求边 ...