从官网下载一个免安装的tomcat,我把它解压在E盘,配置了环境变量:CATALINA_HOME、CATALINA_BASE、TOMCAT_HOME 为 tomcat的解压路径
进入解压tomcat的bin目录,执行startup.bat,出现闪退。
然后win+R 输入cmd 进入解压tomcat的bin目录,输入startup.bat,还是不行。
于是我在startup.bat的开头加入
SET JAVA_HOME=C:\Program Files\Java\jdk-10.0.2 SET TOMCAT_HOME=E:\apache-tomcat-9.0.12-windows-x64\apache-tomcat-9.0.12
然后呢还是不行,会出现下面的提示,快把我郁闷死了。
CATALINA_HOME environment variable is not defined correctly
重复执行startup.bat,发现还是闪退,快郁闷死了,结果下面的方法解决了,敲入这个set
"EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat"
,关闭,再点startup.bat然后成功那个启动了,因为可能读不到bin里面,你需要把bin里面的catalina加进去
set "EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat"
set "CURRENT_DIR=%cd%"
if not "%CATALINA_HOME%" == "" goto gotHome
set "CATALINA_HOME=%CURRENT_DIR%"
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
cd ..
set "CATALINA_HOME=%cd%"
cd "%CURRENT_DIR%"
:gotHome
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:okHome
大功告成