http://stackoverflow.com/questions/16726897/what-tomcat-requires-jdk-or-jre
这是 stackoverflow 上的答案,实际上 jRE 和 JDK 都可以。
What tomcat requires JDK or JRE?
Tomcat's RUNNING.txt which you can find in the root of the bundle states that Apache Tomcat requires Java Standard Edition Runtime Environment (JRE) to run. Minimum version of JRE depends on the version of Tomcat: for Tomcat 6.0 it is Java 5, for Tomcat 7.0 - Java 6.
在 Tomcat 的 RUNNING.txt 中说明了 Tomcat 运行所需要的环境是 JRE,JDK 也是可以的,里面还详细说明了安装步骤,以下是 Tomcat 7.0 的部分说明:
Running The Apache Tomcat 7.0 Servlet/JSP Container
Apache Tomcat 7.0 requires a Java Standard Edition Runtime
Environment (JRE) version 6 or later.
Running With JRE 6 Or Later
(1) Download and Install a Java SE Runtime Environment (JRE)
(1.1) Download a Java SE Runtime Environment (JRE),
release version 6 or later, from
http://www.oracle.com/technetwork/java/javase/downloads/index.html
(1.2) Install the JRE according to the instructions included with the
release.
You may also use a full Java Development Kit (JDK) rather than just
a JRE.
(2) Download and Install Apache Tomcat
(2.1) Download a binary distribution of Tomcat from:
(2.2) Unpack the binary distribution so that it resides in its own
directory (conventionally named "apache-tomcat-[version]").
For the purposes of the remainder of this document, the name
"CATALINA_HOME" is used to refer to the full pathname of that
directory.
...
However you can also use JDK because, as you probably know, it includes JRE (link). The only difference is in the configuration of environment variables. If you use JRE you should set JRE_HOME, if JDK - JAVA_HOME. Read RUNNING.txt for more details.
JDK 中包含 JRE 环境,所以安装 JDK 也可以,它们的不同之处在于,两者的环境变量不同。使用 JRE ,应该设置的环境变量是 JRE_HOME;使用 JDK ,应该设置的环境变量是 JAVA_HOME;
P.S. Web containers may require JDK in order to support JSP, because Java Compiler is required to compile Servlets which are generated from *.jsp files. Tomcat has Eclipse Java Compiler bundle so it can run on JRE and still support JSP. (by duemir)
P.S. 一些 Web 容器(除了 Tomcat 还是很多如 JBOSS, WebLogic)可能要求安装 JDK,因为需要 javac 编译器编译 *.jsp 文件生成的 Servlets 源代码(java 代码)。
Tomcat 中因为内含有 Eclipse Java Compiler bundle 所以它可以在 JRE 环境上运行,并且支持 JSP。
Q: Thanks for the response.But can you clarify me which one is most preferable.
A: since a server should never have software installed that's not strictly required, you should definitely prefer the JRE, unless you need the JDK for some reason - by JoachimSauer
A: I have not thought about it, to be honest. In a development environment I just install JDK and use it with everything. In a production environment I agree with @JoachimSauer - by duemir