tomcat8下载地址:http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.14/bin/apache-tomcat-8.5.14-windows-x64.zip jdk1.8.0下载地址:http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-windows-x64.exe
tomcat解压后在将所有文件复制到C:\tomcat\(没有目录就新建)
环境变量配置:
JAVA环境变量:
JAVA_HOME :C:\Program Files\Java\jdk1.8.0_131(结尾不要加封号)
PATH:%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin
CLASSPATH:.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar
tomcat环境变量:
CATALINA_BASE:c:\tomcat
CATALINA_HOME:c:\tomcat
打开cmd 输入:java 或java -version测试java环境;
打开cmd 进入c:\tomcat\bin\目录,,运行services.bat install
C:\tomcat\bin>service.bat install
Installing the service ‘Tomcat8‘ ...
Using CATALINA_HOME: "C:\tomcat"
Using CATALINA_BASE: "C:\tomcat"
Using JAVA_HOME: "C:\Program Files\Java\jdk1.8.0_131"
Using JRE_HOME: "C:\Program Files\Java\jdk1.8.0_131\jre"
Using JVM: "C:\Program Files\Java\jdk1.8.0_131\jre\bin\server\jvm.d
ll"
The service ‘Tomcat8‘ has been installed.
运行该目录下startup.bat
打开:http://localhost:8080 (正常情况下,你应该可以看到那只猫了)
新增用户:(对于用户的更改必须停止tomcat)
修改c:\tomcat\conf\tomcat-users.xml文件,在最后一个</tomcat-users>前增加以下代码:
<role rolename="manager-gui"/>
<user username="tomcat" password="1234" roles="manager-gui"/>
(增加一个manager-gui角色,并添加用户tomcat 密码是:1234)
运行startup启动tomcat。