Tomcat 为什么运行startup.bat是出现:neither the java_home nor jre_home environment variable isdefined.at least one of these environment variable is needed to run this program.该怎么解决?急如律令~

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/25 06:49:39
Tomcat为什么运行startup.bat是出现:neitherthejava_homenorjre_homeenvironmentvariableisdefined.atleastoneofthe

Tomcat 为什么运行startup.bat是出现:neither the java_home nor jre_home environment variable isdefined.at least one of these environment variable is needed to run this program.该怎么解决?急如律令~
Tomcat 为什么运行startup.bat是出现:neither the java_home nor jre_home environment variable is
defined.at least one of these environment variable is needed to run this program.该怎么解决?急如律令~

Tomcat 为什么运行startup.bat是出现:neither the java_home nor jre_home environment variable isdefined.at least one of these environment variable is needed to run this program.该怎么解决?急如律令~
先看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=D:\Java\jdk1.6.0_11
set JRE_HOME=D:\Java\jre6
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.控制台窗口关闭后,这两个变量也将消失,不会再占用内存.运行一下,最终提示“信息:Server startup in xxxxx ms”就大功告成了.