0.下载:
从官网上下载最新版的TOMCAT: http://tomcat.apache.org/download-60.cgi 找到相应的版本。
根据电脑系统版本,我下载的是apache-tomcat-8.0.20-windows-x86.zip
解压直接放到D盘下,目录为apache-tomcat-8.0.20
1.运行:
找到D:apache-tomcat-8.0.20in下的startup.bat 一闪即过,看不到相关的内容。
用CMD来查看相关的信息提示:
Microsoft Windows [版本 6.1.7600]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
C:UsersAN>d:
D:>cd apache-tomcat-8.0.20in
D:apache-tomcat-8.0.20in>startup.bat
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program
D:apache-tomcat-8.0.20in>
以前电脑上已经安装好了JDK,并配置相关的环境变量。
2.配置:
右键计算机--》属性----》高级系统设置---》进入环境变量
在系统变量中,新建一下项目
变量名: 对应变量值:
JAVA_HOME C:Program FilesJavajdk1.8.0_31
JRE_HOME C:Program FilesJavajre1.8.0_31
3.运行检测:
在次用CMD来查看相关的信息提示:
Microsoft Windows [版本 6.1.7600]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
C:UsersAN>d:
D:>cd apache-tomcat-8.0.20in
D:apache-tomcat-8.0.20in>startup.bat
Using CATALINA_BASE: "D:apache-tomcat-8.0.20"
Using CATALINA_HOME: "D:apache-tomcat-8.0.20"
Using CATALINA_TMPDIR: "D:apache-tomcat-8.0.20 emp"
Using JRE_HOME: "C:Program FilesJavajre1.8.0_31"
Using CLASSPATH: "D:apache-tomcat-8.0.20inootstrap.jar;D:apache-tomcat-8.0.20in omcat-juli.jar"
D:apache-tomcat-8.0.20in>
然后正常显示TOMCAT运行窗口:
11-Mar-2015 11:52:38.947 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.20
11-Mar-2015 11:52:38.949 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Feb 15 2015 18:10:42 UTC
11-Mar-2015 11:52:38.950 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.20.0
11-Mar-2015 11:52:38.950 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 7
11-Mar-2015 11:52:38.950 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 6.1
11-Mar-2015 11:52:38.951 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: x86
11-Mar-2015 11:52:38.951 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: C:Program FilesJavajre1.8.0_31
11-Mar-2015 11:52:38.951 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_31-b13
11-Mar-2015 11:52:38.952 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
11-Mar-2015 11:52:38.952 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: D:apache-tomcat-8.0.20
11-Mar-2015 11:52:38.953 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: D:apache-tomcat-8.0.20
11-Mar-2015 11:52:38.953 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=D:apache-tomcat-8.0.20conflogging.properties
11-Mar-2015 11:52:38.954 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
11-Mar-2015 11:52:38.954 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=D:apache-tomcat-8.0.20endorsed
11-Mar-2015 11:52:38.954 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=D:apache-tomcat-8.0.20
11-Mar-2015 11:52:38.955 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=D:apache-tomcat-8.0.20
11-Mar-2015 11:52:38.955 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=D:apache-tomcat-8.0.20 emp
11-Mar-2015 11:52:38.955 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library 1.1.32 using APR version 1.5.1.
11-Mar-2015 11:52:38.956 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
11-Mar-2015 11:52:40.028 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized (OpenSSL 1.0.1j 15 Oct 2014)
11-Mar-2015 11:52:40.194 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-apr-8080"]
11-Mar-2015 11:52:40.217 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-apr-8009"]
11-Mar-2015 11:52:40.220 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1756 ms
11-Mar-2015 11:52:40.253 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
11-Mar-2015 11:52:40.254 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.20
11-Mar-2015 11:52:40.269 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory D:apache-tomcat-8.0.20webappsdocs
11-Mar-2015 11:52:40.938 INFO [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [332] milliseconds.
11-Mar-2015 11:52:40.967 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory D:apache-tomcat-8.0.20webappsdocs has finished in 699 ms
11-Mar-2015 11:52:40.968 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory D:apache-tomcat-8.0.20webappsexamples
11-Mar-2015 11:52:41.530 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory D:apache-tomcat-8.0.20webappsexamples has finished in 561 ms
11-Mar-2015 11:52:41.530 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory D:apache-tomcat-8.0.20webappshost-manager
11-Mar-2015 11:52:41.573 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory D:apache-tomcat-8.0.20webappshost-manager has finished in 42 ms
11-Mar-2015 11:52:41.575 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory D:apache-tomcat-8.0.20webappsmanager
11-Mar-2015 11:52:41.614 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory D:apache-tomcat-8.0.20webappsmanager has finished in 38 ms
11-Mar-2015 11:52:41.614 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory D:apache-tomcat-8.0.20webappsROOT
11-Mar-2015 11:52:41.682 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory D:apache-tomcat-8.0.20webappsROOT has finished in 68 ms
11-Mar-2015 11:52:41.687 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-apr-8080"]
11-Mar-2015 11:52:41.698 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-apr-8009"]
11-Mar-2015 11:52:41.700 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 1479 ms
至此,java JDK和Tomcat环境配置完成
配置完成以后想确定是否配置成功,以下步骤
1检验java JDK是否配置成功
进入控制台 输入java 如果出现"java"不是内部或外部命令,也不是可运行的程序或批处理文件,说明没有配置成功。反之如果出现java相关的东西则说明成功。
2.检验Tomcat是否配置成功
进入到Tomcat的bin目录下,找到startup.bat,双击运行,如果一散而过,则可能未配置成功(进一步确定,在网页地址栏输入localhost:8080或者127.0.0.1:8080,若没有反应则表示没有配置成功),反之则配置成功
关闭是shutdown.bat
启动出错,可以进入相应的目录后,用catalina run来查看具体的报错,
Microsoft Windows [版本 6.1.7600]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
C:UsersAN>d:
D:>cd apache-tomcat-6.0.43
D:apache-tomcat-6.0.43>cd bin
D:apache-tomcat-6.0.43in>catalina.bat
Using CATALINA_BASE: "D:apache-tomcat-6.0.43"
Using CATALINA_HOME: "D:apache-tomcat-6.0.43"
Using CATALINA_TMPDIR: "D:apache-tomcat-6.0.43 emp"
Using JRE_HOME: "C:Program FilesJavajre1.8.0_31"
Using CLASSPATH: "D:apache-tomcat-6.0.43inootstrap.jar"
Usage: catalina ( commands ... )
commands:
debug Start Catalina in a debugger
debug -security Debug Catalina with a security manager
jpda start Start Catalina under JPDA debugger
run Start Catalina in the current window
run -security Start in the current window with security manager
start Start Catalina in a separate window
start -security Start in a separate window with security manager
stop Stop Catalina
version What version of tomcat are you running?
D:apache-tomcat-6.0.43in>catalina run