tomcat启动报错:Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
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
这两行,重新启动就正常!
上一篇: ios23- 文件下载(同步和异步)
下一篇: WIN10家庭版桌面右键单击显示设置出现ms-settings:display或ms-settings:personalization-background解决办法[原创]
推荐阅读
-
tomcat启动报错:Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
-
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 thi
-
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At least one of these enviro
-
关于Tomcat打开 **闪退** 及出现 **Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
-
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined 完美解决(tomcat error)
-
tomcat8.0启动时显示错误:Neither the JAVA_HOME nor the JRE_HOME environment ... ...
-
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
-
(转)Neither the JAVA_HOME nor the JRE_HOME environment variable is defined解决方案
-
jira error: Neither the JAVA_HOME nor the JRE_HOME environment variable is defin
-
jira error: Neither the JAVA_HOME nor the JRE_HOME environment variable is defin