首先,将官网的安装包先下载并解压到磁盘目录中。 |
---|
官网https://tomcat.apache.org/download-80.cgi链接。 |
如上图,最后一行有个文件,名叫RUNNING
,接下来的内容就是关于它的了。
文中提到:
- JDK版本需在7及以上。
- 设置环境变量
CATALINA_HOME
,值如D:\apache-tomcat-8.5.60
,即压缩包的解压目录。如若不配置,那么启动脚本会D:\apache-tomcat-8.5.60\bin
目录下。但是,官方提示了:这种逻辑可能并不适用于所有情况,因此建议显式设置该变量。 CATALINA_BASE
环境变量,它是可选的。它默认等于CATALINA_HOME
。- 设置
JRE_HOME
或JAVA_HOME
(必需的),JRE_HOME
变量用于指定JRE的位置。JAVA_HOME
变量用于指定JDK的位置。如果同时指定了JRE_HOME
和JAVA_HOME
,则使用JRE_HOME
。 - 在
CATALINA_HOME/bin
目录下,可以添加setenv.bat
(on Windows) orsetenv.sh
(on *nix)文件,来设置一些变量参数。官网说,不能在setenv脚本中配置CATALINA_HOME
和CATALINA_BASE
变量,因为它们用于定位该文件。原因简单解释为,Tomcat要想读到setenv脚本就必须通过配置的CATALINA_HOME
和CATALINA_BASE
变量来定位。 - 可以在
context.xml
文件中,${catalina.home}
变量取值CATALINA_HOME
。
综上所述:下载了tomcat
解压后,除了一定要配置JAVA_HOME
环境变量之外,再配置CATALINA_HOME
环境变量,值为解压后的目录,如:D:\apache-tomcat-8.5.60
。
下文就是,解压后的RUNNING.txt
文件中的中英对照,参考的有道翻译。
================================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================================================
===================================================
Running The Apache Tomcat 8.5 Servlet/JSP Container
运行Apache Tomcat 8.5 Servlet/JSP容器
===================================================
Apache Tomcat 8.5 requires a Java Standard Edition Runtime Environment (JRE) version 7 or later.
Apache Tomcat 8.5需要Java标准版运行时环境(JRE)版本7或更高版本。
=============================
Running With JRE 7 Or Later
使用JRE 7或更高版本运行
=============================
(1) Download and Install a Java SE Runtime Environment (JRE)
(1)下载并安装Java SE运行时环境(JRE)
(1.1) Download a Java SE Runtime Environment (JRE),
release version 7 or later, from
http://www.oracle.com/technetwork/java/javase/downloads/index.html
(1.1) 下载Java SE运行时环境(JRE),发行版本7或更高。
(1.2) Install the JRE according to the instructions included with the release.
(1.2) 根据发行版附带的说明安装JRE。
You may also use a full Java Development Kit (JDK) rather than just a JRE.
您还可以使用完整的Java开发工具包(JDK),而不仅仅是JRE。
(2) Download and Install Apache Tomcat
(2) 下载安装Apache Tomcat
(2.1) Download a binary distribution of Tomcat from:
(2.1) 从以下地方下载Tomcat的二进制版本:
https://tomcat.apache.org/
(2.2) Un