I've read many articles and posts related to Tomcat and the Java runtime. I am confused and need help. Can anybody clear my doubt regarding whether Tomcat requires JDK or JRE?
Thanks in advance.
Tomcat does not require a JDK. It needs a JRE only. JSP compilation is done by the bundled Eclipse compiler.
ya java -version says it is java 1.7.
The JDK includes the JRE, so you do not have to download both separately. To understand the version-string scheme that is used to distinguish various JDK and JRE releases, see Version-String Format.
3 Answers. JRE is a part of JDK. No need to have JRE when you have JDK.
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.
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.
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.
The only notable difference using JDK over JRE is to enable debug mode when launching tomcat jvm.
in the RUNNING.txt we don't have clear distinction, the text deals with certain options, without telling which one :
Using JAVA_HOME provides access to certain additional startup options that are not allowed when JRE_HOME is used.
the information is inside catalina.sh script :
# JAVA_HOME Must point at your Java Development Kit installation. # Required to run the with the "debug" argument.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With