在使用Myeclipse中使用到tomcat的配置,其实tomcat的配置与jdk的配置差不多。我用tomcat6.0举例以下是配置tomcat的时候需要注意的几点:
我的tomcat6在电脑的路径是:D:\javaweb\apache-tomcat-8.5.23
(1)在系统变量中添加:CATALINA_BASE 变量值中填D:\javaweb\apache-tomcat-6.0.36
CATALINA_HOME 变量值中填D:\javaweb\apache-tomcat-6.0.36
(2)在path变量中添加:%CATALINA_HOME%\lib
%CATALINA_HOME%\bin
%JAVA_HOME%\lib
%JAVA_HOME%\bin
一点小提示:如果你用cmd检查提示 java_HOME或CATALINA_HOME有错,先检查以上的环境变量有没有写错,如果还提示错误
建议你找到tomcat6.0里的startup.bat进行编辑
if "%OS%" == "Windows_NT" setlocal
rem ---------------------------------------------------------------------------
rem Start script for the CATALINA Server
rem
rem $Id: startup.bat 908749 2010-02-10 23:26:42Z markt $
rem ---------------------------------------------------------------------------
rem Guess CATALINA_HOME if not defined
set JAVA_HOME=D:\java\jdk (需要添加jdk的路径)
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
()
(3)在classpath里添加:D:\javaweb\apache-tomcat-6.0.36\lib\servlet-api.jar
(4) 在系统变量中添加:JRE_HOME D:\java\jre
根据此路径D:\javaweb\apache-tomcat-6.0.36\bin打开 startup.bat出现下图情况证明tomcat配置好了: