启动tomcat时一闪而过文件注释:[4]setclass
本文与“启动tomcat时一闪而过解决方法”属于一个系列的文档,请注意前后一起查阅。
操作方法
- 01
//删除冗余的注释语句(即rem 开头的语句),其中rem表示注释,echo表示输出,setclasspath.bat文件内容如下: //根据文件的名称,我们应该可以知道这个文件主要是用来 设置程序运行的环境变量的 @echo off rem Make sure prerequisite environment variables are set if not "%JAVA_HOME%" == "" goto gotJdkHome //如果JAVA_HOME环境变量不是空的,就跳转gotJdkHome处 if not "%JRE_HOME%" == "" goto gotJreHome //如果JRE_HOME环境变量不是空的,就跳转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 //退出当前的bat文件,并返回一个参数给catalina.bat :gotJreHome if not exist "%JRE_HOME%\bin\java.exe" goto noJavaHome //如果找不到java.exe与javaw.exe文件 就跳转noJavaHome处执行 if not exist "%JRE_HOME%\bin\javaw.exe" goto noJavaHome if not ""%1"" == ""debug"" goto okJavaHome //如果不是debug模式启动时,跳转到okJavaHome处执行 echo JAVA_HOME should point to a JDK in order to run in debug mode. //提示错误信息 goto exit //退出当前的bat文件,并返回一个参数给catalina.bat :gotJdkHome if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome //如果找不到java.exe、javaw.exe、jdb.exe、javac.exe文件 就跳转noJavaHome处执行 if not exist "%JAVA_HOME%\bin\javaw.exe" goto noJavaHome if not exist "%JAVA_HOME%\bin\jdb.exe" goto noJavaHome if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome if not "%JRE_HOME%" == "" goto okJavaHome // 如果环境变量JRE_HOME不为空 跳转到okJavaHome处执行 set "JRE_HOME=%JAVA_HOME%" //设置环境变量JRE_HOME = JAVA_HOME goto okJavaHome :noJavaHome // 提示错误信息 echo The JAVA_HOME environment variable is not defined correctly echo This environment variable is needed to run this program echo NB: JAVA_HOME should point to a JDK not a JRE goto exit //退出当前的bat文件,并返回一个参数给catalina.bat :okJavaHome if not "%BASEDIR%" == "" goto gotBasedir //BASEDIR环境变量 不是空的 跳转到gotBasedir处执行 echo The BASEDIR environment variable is not defined // 提示错误信息 echo This environment variable is needed to run this program goto exit //退出当前的bat文件,并返回一个参数给catalina.bat :gotBasedir if exist "%BASEDIR%\bin\setclasspath.bat" goto okBasedir // 如果存在setclasspath.bat 跳转到okBasedir处执行 echo The BASEDIR environment variable is not defined correctly // 否则提示错误信息 echo This environment variable is needed to run this program goto exit //退出当前的bat文件,并返回一个参数给catalina.bat :okBasedir rem Don't override the endorsed dir if the user has set it previously if not "%JAVA_ENDORSED_DIRS%" == "" goto gotEndorseddir //如果JAVA_ENDORSED_DIRS不是空的 跳转到gotEndorseddir处执行 rem Set the default -Djava.endorsed.dirs argument set "JAVA_ENDORSED_DIRS=%BASEDIR%\endorsed" //设置 JAVA_ENDORSED_DIRS值 :gotEndorseddir rem Set standard command for invoking Java. rem Note that NT requires a window name argument when using start. rem Also note the quoting as JAVA_HOME may contain spaces. set _RUNJAVA="%JRE_HOME%\bin\java" //设置 _RUNJAVA set _RUNJDB="%JAVA_HOME%\bin\jdb" //设置_RUNJDB goto end :exit exit /b 1 //退出bat文件,返回一个参数值 1 :end exit /b 0 // 退出bat文件,返回一个参数值 0