Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Tomcat require JDK or JRE?

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.

like image 796
JDGuide Avatar asked May 24 '13 02:05

JDGuide


People also ask

Does Tomcat require Java to be installed?

Tomcat does not require a JDK. It needs a JRE only. JSP compilation is done by the bundled Eclipse compiler.

Which Java is used by Tomcat?

ya java -version says it is java 1.7.

Is JRE required for JDK?

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.

Can JRE be installed without JDK?

3 Answers. JRE is a part of JDK. No need to have JRE when you have JDK.


2 Answers

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.

like image 60
duemir Avatar answered Oct 18 '22 21:10

duemir


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. 
like image 30
buzard Avatar answered Oct 18 '22 21:10

buzard