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. 最近在写一些树上的东西,先发一波LCA的吧!

    不会树剖的我只有去学tarjan和倍增了,个人觉得倍增比tarjan好打一点... tarjan学习的地方 http://www.cnblogs.com/JVxie/p/4854719.html 个人 ...

  2. Python_018( isinstance,issubclass详解)

    1.isinstance() 1)class A:pass class B:pass b = B() print(isinstance(b,B) #True  #isinstance(obj,type ...

  3. window 连接服务器工具

    Xshell xftp 下载网址 以上两个软件均免费, 只需要邮件激活即可. 其中 xshell 主要用来连接服务器,方便使用命令行.xftp 方便传输文件.

  4. jdk7.x对Jenkins上的SonarQube Plugin的支持不足,替换方式

    Jenkins.war放在Tomcat7下,完成各种配置,包括Jenkins中JDK,Maven,Git等. 最初的配置为Tomcat7, JDK7.x. 因为要在Jenkins上安装SonarQub ...

  5. UOJ37. 【清华集训2014】主旋律

    http://uoj.ac/problem/37 题解 题目是让我们求出有多少个边集可以使这张图强连通. 先补集转化一下,求这张图不强连通的方案数. 我们考虑这样的图缩完点之后的情况,既然不强连通,那 ...

  6. YJJ's Salesman

    YJJ's Salesman YJJ is a salesman who has traveled through western country. YJJ is always on journey. ...

  7. iOS开发自定义字体之静态字体

    最后更新 2017-04-25 在iOS开发中经常会用到字体, 一般字体文件比较小的,单一的,几十k, 可以通过内置进去;如果字体文件比较多或者字体文件比较大,通常通过动态加载方式. 静态加载方式 将 ...

  8. 模拟vue实现简单的webpack打包

    一.安装nodejs,查看是否安装成功 二.package.json项目初始化 npm init 电脑有node环境,在根目录下运行命令npm init初始化项目,根据提示输入项目相关信息,然后运行. ...

  9. multipages-generator今日发布?!妈妈再也不用担心移动端h5网站搭建了!

    本文适合的读者?‍?‍?‍? 现在在手淘,京东,今日头条,美柚等过亿用户的手机app中的,都常见h5网页,他们有更新快,灵活,便于分享和传播的特性.这里有他们中的几个h5的例子:(手淘,美柚).这些a ...

  10. weui 框架

    weui是一个框架,但是官方并没有提供文档: 所以我们需要在github上来通过案例来了解他的用法 一般做列表,左边的图片要么60x60,要么80x80用的比较多 weui是一个小巧的框架,所以带来的 ...