1.安装完Tomcat配置环境以后,如果出现以下情况:
点击tomcat\bin目录下startup批处理文件时,dos界面出现闪退情况;
先要找出问题的原因:右键编辑打开“startup.bat"文件,然后找文件的最后一行代码是:end 在:end的后面输入pause
重新运行startup.bat,此时提示报错信息如下:the jre_home environment variable is not defined correctly this environment variable is need
解决办法:
1、分析startup.bat启动脚本:发现其调用了catalina.bat,而catalina.bat调用了setclasspath.bat
2、在setclasspath.bat的头部定义了JAVA_HOME和JRE_HOME的值,那么这里需要我们手动设置JAVA_HOME变量和JRE_HOME变量(红色代码为新添加)
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:\tomcat\apache-tomcat-7.0.65
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